Reputation: 93
I have a dataset labeled covid19india. I used a dataset to forecast the number of cases using the following code and got the graph as desired. I am ok up to this point, but need help in calculating the RMSE and plotting the ACF plot of residuals to theoretically show that the model is feasible.
set1 <- covid19india[1:36,]
df <- set1[3]
tddf1 <- ts(df$`Cumulative cases`)
fit1 <- auto.arima(df$`Cumulative cases`, seasonal = FALSE)
forecast3 <- forecast(fit1, h=9)
plot(forecast3)
par(new=TRUE)
plot(days, df1)
I need help in calculating the RMSE and residual ACF plot.
Upvotes: 1
Views: 2281
Reputation: 1336
You should use the function checkresiduals
presents in the forecast
package.
Below a simple example.
>library(forecast)
>fit_1<-auto.arima(your_data_set)
>forecast(fit_1, h = 10) # h is the period that you want to forecast.
>checkresiduals(fit_1)
To check instead the RMSE
you could use the function accuracy
> accuracy(fit_1)
ME RMSE MAE MPE MAPE MASE ACF1
Training set 2.236275e-05 0.02440796 0.01829821 -Inf Inf 0.8858579 -0.01149095
If you'd like to deep you should check this
This link is the free book that the Prof. Rob J Hyndman and Prof George Athanasopoulos wrote (are the authors of the forecast package).
Upvotes: 1