繁体   English   中英

小时间序列分析

[英]small Time Series Analysis

我需要对未来 2 年做出预测。 但是,我的数据量非常少。 数据:

   structure(list(BelegDat = structure(c(16801, 16832, 16861, 16892, 
    16922, 16953, 16983, 17014, 17045, 17075, 17106, 17136, 17167, 
    17198, 17226, 17257, 17287, 17318, 17348, 17379, 17410, 17440, 
    17471, 17501, 17532, 17563, 17591, 17622, 17652, 17683, 17713, 
    17744, 17775, 17805, 17836, 17866, 17897, 17928, 17956, 17987, 
    18017, 18048, 18078, 18109, 18140, 18170, 18201, 18231), class = "Date"), 
        Value = c(37, 28, 37, 47, 37, 28, 37, 37, 19, 37, 37, 28, 
        40, 30, 40, 50, 40, 30, 40, 40, 20, 40, 40, 30, 30, 40, 30, 
        30, 40, 30, 30, 50, 30, 50, 20, 20, 60, 20, 60, 40, 20, 10, 
        40, 20, 20, 10, 44, 33)), row.names = c(NA, -48L), class = "data.frame")

我正在使用 ARIMA:

myts <- ts(df_ready[,2], start=c(2016,01), end=c(2019,12), frequency = 12)

fit <- auto.arima(myts)

pred <- forecast(fit, 24) # next 2 years (24 Months)
plot(pred)

我的输出:输出

能否请你告诉我我的错误/建议一些其他方式如何完成这个预测?

先感谢您!

auto.arima有一个名为D的参数。 我们需要将其设置为1以强制 arima 使用季节性模型。 在这种情况下,

m1 <- ts(df$Value, start = min(df$BelegDat), frequency = 12)
autoplot(forecast(auto.arima(m1, D = 1), 24)) 

这使,

在此处输入图片说明

您的数据不支持任何季节性证据; 您的数据与偏移偏移的白噪声一致。

强制使用特定的 SARIMA 结构,然后根据您的白噪声数据使用它进行预测是非常危险的。

为了演示,让我们扭转局面并生成白噪声数据,这些数据偏移相同的偏移量并且与您的样本数据具有相同的方差。 请记住,这是设计上的白噪声

library(forecast)
library(ggplot2)
set.seed(2018)
ts <- ts(
    rnorm(48, mean = 33.8750, sd = 11.15796),
    start = c(2016, 1), frequency = 12)
autoplot(ts) + theme_minimal()

在此处输入图片说明

我们现在将 SARIMA(0, 0, 0)(0, 1, 0) 12模型拟合到数据中。

fit <- arima(ts, order = c(0, 0 , 0), seasonal = list(order = c(0, 1, 0), period = 12))
fit
#
#Call:
#arima(x = ts, order = c(0, 0, 0), seasonal = list(order = c(0, 1, 0), period = 12))
#
#
#sigma^2 estimated as 283:  log likelihood = -152.7,  aic = 307.39

再次记住,数据是从 ARIMA(0,0,0) = SARIMA(0,0,0)(0,0,0) 生成的,即白噪声模型。

我们现在使用fit来预测

autoplot(forecast(ts, h = 24, model = fit)) + theme_minimal()

所以我们在这里所做的是根据白噪声数据进行预测,假设不存在季节性影响。

在此处输入图片说明

是的,您可以做到这一点,而无需在forecast引发任何警告/标志。 不,这些预测没有意义。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM