[R] Resampling 1 time series at another set of (known) irregularly spaced times

Bert Gunter bgunter@4567 @ending from gm@il@com
Thu Jan 10 00:37:01 CET 2019


John:

Clarification: Do you mean you just want an "irregular" subset of your
*given* data values/times, or do you want times randomly over the series
duration for which you will construct values, which is what Jeff described.

The former is trivial: see ?sample with the "replace" argument = FALSE :
you're actually just sampling from the integer vector of time indices here,
so sample.int would even do. For the latter, I would presume you could use
?runif to sample arbitrary times over the time series duration and then
follow Jeff's suggestions to fill in values for these times using methods
to which he referred you.

Or have I misunderstood completely?

Cheers,
Bert

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Jan 9, 2019 at 3:17 PM Jeff Newmiller <jdnewmil using dcn.davis.ca.us>
wrote:

> The key to accomplishing this is to clarify how you want to address
> selecting values between the existing points, but there are many base R
> functions and packages that address this problem. In general the methods
> fall into two categories: interpolation and smoothing. Interpolation
> includes piecewise linear interpolation, splines,
> last-observation-carried-forward, and  first-order-extrapolation, all of
> which yield the same values of applied only at the original independent
> values. Smoothing methods such as regression, loess, kriging, and kernel
> interpolation may not have this identity property but you don't need unique
> input values at each independent variable value either.
>
> Read some Task Views, e.g.
>
> https://cran.r-project.org/web/views/NumericalMathematics.html
>
> https://cran.r-project.org/web/views/TimeSeries.html
>
> https://cran.r-project.org/web/views/MissingData.html
>
>
>
> On January 9, 2019 2:55:04 PM PST, John Hillier <J.Hillier using lboro.ac.uk>
> wrote:
> >Dear All,
> >
> >
> >I would appreciate a quick pointer in the right direction (e.g. www
> >page I could look at, or indicator of which function within a package).
> >
> >
> >The problem: I have a regular time series of values x at times t (i.e.
> >t, x). I would like to sample them at irregular, known times - this is
> >a second time series (T).
> >
> >
> >I can move these data between formats as required (i.e. file, vector,
> >matrix, ts etc ....)
> >
> >
> >I have been searching around for a while and found many packages to
> >regularise time-series (e.g. xts, lubricate, ..... ), but not the
> >reverse as I want to.
> >
> >
> >Before you ask, I know it might seem a bit odd, but it is necessary for
> >the particular question I'm asking.
> >
> >
> >Thank you for your time,
> >
> >
> >John
> >
> >
> >-------------------------
> >Work days: Mon-Thurs
> >Web page: <http://homepages.lboro.ac.uk/~gyjh5/>
> ><http://www.lboro.ac.uk/departments/geography/staff/john-hillier/>
> >http://www.lboro.ac.uk/departments/geography/staff/john-hillier/
> >Latest research:
> >http://publications.lboro.ac.uk/publications/all/collated/gyjh5.html<
> https://lb-public.lboro.ac.uk/cgi-bin/personcite?username=gyjh5&dobranding=1&hits=10
> >
> >
> >Dr John Hillier
> >Senior Lecturer & NERC Knowledge Exchange Fellow (Insurance Sector)
> >Geography and Environment
> >Loughborough University
> >01509 223727
> >
> >       [[alternative HTML version deleted]]
> >
> >______________________________________________
> >R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >https://stat.ethz.ch/mailman/listinfo/r-help
> >PLEASE do read the posting guide
> >http://www.R-project.org/posting-guide.html
> >and provide commented, minimal, self-contained, reproducible code.
>
> --
> Sent from my phone. Please excuse my brevity.
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list