【问题标题】:Calculating the RMSE and ACF plot of residuals of ARIMA model in R计算 R 中 ARIMA 模型残差的 RMSE 和 ACF 图
【发布时间】:2020-04-21 18:47:01
【问题描述】:

我有一个标记为 covid19india 的数据集。我使用数据集使用以下代码预测案例数量,并根据需要获得图表。到目前为止我还可以,但是在计算 RMSE 和绘制残差的 ACF 图以从理论上表明该模型是可行的时需要帮助。

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)

我需要帮助来计算 RMSE 和残差 ACF 图。

【问题讨论】:

    标签: r arima


    【解决方案1】:

    您应该使用checkresiduals 包中的forecast 函数。

    下面是一个简单的例子。

        >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)
    

    要检查RMSE,您可以使用函数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
    

    如果您想深入了解,请查看this

    此链接是 Rob J Hyndman 教授和 George Athanasopoulos 教授(是预测包的作者)撰写的免费书籍。

    【讨论】:

      猜你喜欢
      • 2019-05-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-26
      • 1970-01-01
      • 2021-07-26
      • 1970-01-01
      • 2018-12-06
      相关资源
      最近更新 更多