I am a new student approaching ARIMA prediction analysis in R. If the question is too simple or incorrect, please forgive and guide me.

I am currently using the ARIMA provided in R. I use the data as the rainfall time series to forecast rainfall for the next several years.

My data: https://drive.google.com/drive/u/1/folders/1MmFeWoUSfXrGNbsL4SiK28FoMAby0gwD

I used the code to draw the following diagram:

datats <- ts(mydata, start = c(2000,1), frequency = 12)
adf.test (datats, alternative = "stationary")
plot(datats, xlab="Year", ylab="Rainfall(mm)", main="Rainfall in Quy Nhon since 2000 to 2017", lwd=4, col="chartreuse4")
dec <- decompose(datats, type = "additive")
plot(dec, col= "firebrick1", lwd = 3)
acf (ts (datats), main="ACF For Rainfall", col="blue", lwd = 4)

enter image description here

enter image description here

enter image description here

Because our data has a rainfall month with a negative value, I used the command auto.arima () with the properties as follows:

ARIMAfit <- auto.arima(y=log(datats + 1), approximation = FALSE, trace = TRUE, ic="aic", test="kpss")

Code run result: Best model: ARIMA(0,0,0)(0,1,1)[12]

%Series: (log(datats + 1)) 
%sigma^2 estimated as 1.064:  log likelihood=-304.42
%AIC=612.84   AICc=612.9   BIC=619.48

Make predictions for the next 48 months:

fact <- forecast (ARIMAfit, h=48)

Code run result:

enter image description here

After that, I proceeded to graph the predictive data for the data using the exp() function - to convert the predicted value into the original value.

plot(exp(fact), col = "chartreuse4", lwd=3)

But this results in an error: Error in exp(fact) : non-numeric argument to mathematical function

My question is:

  1. Could you please help me to see if my prediction method is accurate and how to handle errors in R?

  2. Could you please help me run the code in R to predict rainfall according to the above data?


1 Answer 1


You asked 2 questions ...

1)Could you please help me to see if my prediction method is accurate and how to handle errors in R.

I wouldn't think so because you didn't fully extract a sufficient equation as per Help me about using ARIMA forecasting rainfall

2) Could you please help me run the code in R to predict rainfall according to the above data

can't help you there !

your arima model ( in logspace ) is essentially self-cancelling

[(1-B** 12)]Y(T) = + [(1- .885B** 12)] [A(T)]

[(1-1.0B** 12)]Y(T) = + [(1- .885B** 12)] [A(T)]

Y(T) = +{ [(1- .885B** 12)]/[(1-1.0B** 12)] } [A(T)]

or Y(T)= Y(T-12) + .885* A(T-12)

imposing an unwarranted seasonal differencing yields a now necessary seasonal ma seasonal coefficient

The errors from your model are HUGE reflecting a model that has not adequately dealt with the observed data

It devolves to a seasonal random walk forecast.

enter image description here

With a low R square value

R Square = .420171

Also a simultaneous plot of the actual and model errors is dispiriting

enter image description here

  • $\begingroup$ Thanks @IrishStart very much. This means that it is not appropriate to choose the coefficients in the ARIMA model. $\endgroup$ Nov 28, 2019 at 14:52
  • $\begingroup$ more importantly it didn't chose an appropriate model . Note that the parameter is optimal for the chosen model BUT it is not a good choice of model. $\endgroup$
    – IrishStat
    Nov 28, 2019 at 14:54
  • $\begingroup$ Thanks for your enthusiastic support. Would you please explain to me how to choose the factors to optimize the model, thank you $\endgroup$ Nov 28, 2019 at 14:59
  • $\begingroup$ one needs to set up a tournament where one identifies and combines both memory (arima) and latent deterministic structure simultaneously. The arima prtion is similar but distinctly superior to auto.arima and the latent deterministic structure is similar to the results from tsoutlier . AUTOBOX ( a commercial piece of software that I have helped to develop with an R interface) weaves them together with validating parameter and error variance constancy over time. If you wanted to write your own scripts in R to duplicate my results it might take some effort on your behalf. $\endgroup$
    – IrishStat
    Nov 28, 2019 at 15:28
  • 1
    $\begingroup$ bothers ? I am not sure what you are stating/asking . some additional reading for you on time series modelling . stats.stackexchange.com/search?tab=newest&q=user%3a3382 $\endgroup$
    – IrishStat
    Nov 28, 2019 at 16:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.