[R] time series, uneven length

R. Michael Weylandt michael.weylandt at gmail.com
Wed Aug 8 17:19:16 CEST 2012


On Wed, Aug 8, 2012 at 7:53 AM, joel.green <joel.green at live.co.uk> wrote:
> I have 4 univariate time series that I believe have correlation between them,
> I want to create a VAR model between them all.
>
> However I have an issue as 3 of them are the same length, however the 4th is
> smaller.  meaning that i cannot use the 4th variable , is there anyway R can
> get round this issue?
>
>> length(tstemp)
> [1] 746
>> length(tspres)
> [1] 746
>> length(tswind)
> [1] 746
>> length(tsozon)
> [1] 658
>
>> ccf(tstemp,tsozon)
> Error in ccf(tstemp, tsozon) : univariate time series only
>

Good morning Joel,

I'm afraid it's not the length issue that gives the error:

x <- ts(rnorm(746)); y <- ts(rnorm(646)); ccf(x, y)

but rather that one of your series is actually multivariate already
(i.e., has multiple columns) -- check

NCOL(x)

for each of them and you'll find the problem.

If that doesn't help, try to work up a reproducible example as described here:

http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

Cheers,
Michael

> thanks
>
>
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/time-series-uneven-length-tp4639582.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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