[R] time series analysis for a time series without a regular frequency
Achim Zeileis
Achim.Zeileis at wu-wien.ac.at
Sat Jan 9 15:07:51 CET 2010
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.
>
>
More information about the R-help
mailing list