Minh
Minh

Reputation: 2310

Time Series for Periods Over One Year

I'm having trouble doing time series for my data set. Most examples have quarterly or monthly frequencies but my issue comes with data that is collect annually or every two years. Consider my code:

data<-data.frame(year=seq(1978,2012,2), number=runif(18,100,500))
time<-ts(data$number, start=1978, frequency=.5)
decomp<-decompose(time)
Error in decompose(time) : time series has no or less than 2 periods

How do I make R recognize time series values from data that is collected over an annual basis? Thanks!

Upvotes: 0

Views: 344

Answers (1)

DatamineR
DatamineR

Reputation: 9618

Seasonal decomposition only makes sense with intra-yearly data, because you have seasons within years. So, trying to calculate seasonal effects with decompose on data collected every two years you get the error.

Upvotes: 1

Related Questions