0
$\begingroup$

For sunspot dataset. Below is the ARIMA code. Auto ARIMA finds the best ARMA(2,1,2)(2,0,1) model. But when I plot the prediction seems wrong:

#ACF Plots
acf(sunspots)
pacf(sunspots)

#differenced data acf pacf
#p : AR, d : I, q : MA

acf(diff(sunspots)) #check if there's any seasonal pattern
pacf(diff(sunspots))

enter image description here enter image description here

## find best ARMA(p,q) model
auto.arima(sunspots, start.p=0, max.p=3, start.q=0, max.q=3)

fit <- arima(sunspots, c(2, 1, 2), seasonal = list(order = c(2, 0, 1), period = 12))
AIC(fit)
tsdisplay(residuals(fit), main="fit2residual")
pred <- predict(fit, n.ahead = 240)

#ts.plot(sunspots,pred$pred, log = "x", lty = c(1:3))

years20_pred<-pred$pred
years20_se<-pred$se

plot(sunspots,xlim=c(1700,2015),col="grey",lwd=1.5,ylab="sunspots")
lines(years20_pred, col="green",lwd=1.5)

enter image description here This prediction seems wrong because the line should be higher and should follow the previous pattern.

Using just AR is giving better prediction graph:

y<- ar(sunspots)

AIC(fit)
tsdisplay(residuals(fit), main="fit2residual")

years20<-predict(y,n.ahead=240)
years20_pred<-predict(y,n.ahead=240)$pred
years20_se<-predict(y,n.ahead=240)$se

plot(sunspots,xlim=c(1700,2015),col="grey",lwd=1.5,ylab="sunspots")
lines(years20$pred, col="green",lwd=1.5)

enter image description here

I tried different combinations and in many ways but not sure where I am doing wrong. From ACF and PCF graph it seems I should use MA model and should handle seasonality.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.