0
$\begingroup$

I have data on temperature from 1969 to 2013 (link).

I want to predict next year's temperature using an ARIMA model with finding correlation between predicted value and actual value. So I want to use data from 1969 to 2010 and then I want to predict for next 3 years. Furthermore, I want to compare it with the actual value and plot the graph and find accuracy.

But just to predict I gave all input from 1969 to 2013. I want to predict for the next year. As by seeing the ACF and PACF, I found that one difference is sufficient. My code is like this:

read   <- read.csv('G:/URMAY_CODE/day_temp_file.csv')
read_1 <- ts(read[,2], start=c(1969,1), frequency=365.25) 

ARIMA_FIT <- auto.arima(read_1, d=1, approximation=T, trace=T)
## Best model: ARIMA(3,1,1)
summary(ARIMA_FIT)
acf(residuals(ARIMA_FIT))
## I have plot ACF of the residuals form the arima(3,1,1) ##
plot(forecast(ARIMA_FIT), xlab="temperature", ylab="years")
## this shows me forecast like this

result for forcasting

I want something like zig-zag like but it is not giving that. I searched all the way through internet they are directly plotting the graph like this, but they are getting a zig-zag graph.

Sub Question: What is the role of xreg in auto.arima(), and how it is applicable to my code?

(I need help with the plotting as well as the comparison.)

$\endgroup$
  • 1
    $\begingroup$ To the extent I can follow this, it seems to be asking for code / code help, which is off topic here. If you have a statistical question about ARIMA, please edit to clarify. $\endgroup$ – gung Nov 29 '16 at 1:53
  • 2
    $\begingroup$ As far as I can tell, there are two things going on here. (1) The forecasts in the graph are probably forecasts for a transformed version of the data - not the data in levels. (2) There is no periodic (zig-zag) pattern because you have not chosen a seasonal ARIMA model. Lastly, you use xreg if you have exogenous explanatory variables, but if you're basing your forecasts on the time-series properties of the data, you don't need this feature. $\endgroup$ – Graeme Walsh Nov 29 '16 at 2:12
  • $\begingroup$ @RichardHardy i tried by applying frequency=365.25/7 but still it is showing the same graph with title like this forcasts from ARIMA(3,1,1)(1,0,0)[52] i want graph like (zig-zag) with value .. so that i can find correlation with original value. $\endgroup$ – Hiren Nov 29 '16 at 16:56
  • 1
    $\begingroup$ I think it is still a matter of wrong frequency. auto.arima should definitely pick up this pattern as long as the relevant frequency is specified. What is the actual frequency of your data and how long a period does it span? (The lack of labels for the horizontal axis does not help.) $\endgroup$ – Richard Hardy Nov 29 '16 at 17:02
  • 1
    $\begingroup$ OK, my suggestion of using weekly frequency was stupid, I am embarrased. I see you have 45 years of daily data. Hmm. Since your seasonal period is so long, SARIMA is not really suitable; see Rob J. Hyndman "Forecasting with long seasonal periods" for an alternative approach with code examples. That should help. $\endgroup$ – Richard Hardy Nov 29 '16 at 18:01

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.