Reputation: 21
Coding to forecast using ARIMA model. The data is one single column in .txt file and it is Once every year. (tornadoes per year) Therefore, the frequency = 1, However, it gives me an error when i try to decompose it "time series has not or less than 2 periods". I have looked at other answers, however, i can't follow them correctly. I am new to R. Below is the code i am using.
tornadoes <- read.table("http://m.uploadedit.com/ba3k/144533803481.txt")
tornadoestimeseries <- ts(tornadoes, frequency=1, start=c(1949,1))
tornadoestimeseries
plot.ts(tornadoestimeseries)
tornadoestimeseriescomponents <- decompose(tornadoestimeseries)
plot(tornadoestimeseriescomponents)
Upvotes: 2
Views: 8633
Reputation: 3448
I couldn't reach your file, so I created another time series. I divided your data into multiples of 12 periods. See if this helps:
tornadoes <- c(100,50,100,80,70,80,90,200,140,20,30,50,100,70,90,200,120,100,60,70,110,40,80,100,110,110,210)
tornadoes12=c(matrix(data=tornadoes,ncol=length(tornadoes),nrow=12, byrow = TRUE))/12
tornadoestimeseries <- ts(tornadoes12, frequency=12)
tornadoestimeseries
tornadoestimeseriescomponents <- decompose(tornadoestimeseries)
plot(tornadoestimeseriescomponents)
Upvotes: 0