An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20100108/cbcd85a4/attachment.pl>
time series analysis for a time series without a regular frequency
3 messages · Erin Hestir, Gabor Grothendieck, Achim Zeileis
The zoo package supports irregularly spaced time series and if your create a zoo object z from your data then tt <- as.ts(z) will give you a ts object, tt. Since a ts object must be regularly spaced this will add NAs to ensure that it is.
On Fri, Jan 8, 2010 at 3:05 PM, Erin Hestir <elhestir at ucdavis.edu> wrote:
Hello, I am trying to conduct a time series analysis on historic hydrologic data, but I cannot coerce it into class ts because it does not have regular sampling intervals (some years have 20 samples, other have 8). Specifically I am trying to perform a CUSUM or or other step change detection, but the packages all seem to require data as ts. Is there a way to coerce my data into ts while maintaining all of my samples? Or alternatively, can someone recommend a package that does not require data as ts? Thanks! -- Erin Hestir Center for Spatial Technology and Remote Sensing University of California Davis ? ? ? ?[[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list 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.
On Fri, 8 Jan 2010, Erin Hestir wrote:
I am trying to conduct a time series analysis on historic hydrologic data, but I cannot coerce it into class ts because it does not have regular sampling intervals (some years have 20 samples, other have 8). Specifically I am trying to perform a CUSUM or or other step change detection, but the packages all seem to require data as ts.
As Gabor already pointed out: the zoo package can be used to store such
data.
If you want to use the strucchange package for detecting changes then you
can do two things:
- use a plain data.frame (without ts or some other time
series class) which can be easily produced via
as.data.frame(zoo_obj).
Then the axis annotation in graphics won't be the time axis but
the standard unit interval (= proportion of data). This is not so
pretty but all statistical interpretations are still correct.
- If zoo_obj is just a univariate series and you want to conduct a
CUSUM test for a change in the mean you can do
cus <- gefp(zoo_obj ~ 1)
plot(cus)
plot(cus, functional = meanL2BB)
and so on. gefp() is the only function in strucchange that
automatically supports "zoo".
hth,
Z
Is there a way to coerce my data into ts while maintaining all of my samples? Or alternatively, can someone recommend a package that does not require data as ts? Thanks! -- Erin Hestir Center for Spatial Technology and Remote Sensing University of California Davis [[alternative HTML version deleted]]
______________________________________________ R-help at r-project.org mailing list 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.