如何更改我的 auto arima 功能中的频率
How to change the frequency in my auto arima function
我有一个时间序列(tsibble 对象),我需要应用 auto.arima
函数来查找我的模型。该对象在 7 年内以每天的频率出现
# A tsibble: 2,557 x 2 [1D]
bcUI Date
<dbl> <date>
1 13.6 2012-01-01
2 36.0 2012-01-02
3 33.7 2012-01-03
4 200. 2012-01-04
5 150. 2012-01-05
6 230. 2012-01-06
7 79.7 2012-01-07
8 65.7 2012-01-08
9 25.5 2012-01-09
10 35.7 2012-01-10
# ... with 2,547 more rows
当我应用函数时
autoarima1<-auto.arima(bctsibble,trace = TRUE,approximation = FALSE,seasonal = TRUE)
结果出现的频率为 7:
Best model: ARIMA(1,0,0)(2,0,0)[7] with non-zero mean
如何更改此频率?数据太大,无法全部共享。谢谢!
首先,您有一个 tsibble
对象,因此您应该使用寓言包进行自动 ARIMA 建模。 forecast 包中的 auto.arima()
函数是为 ts
对象设计的。以下是如何使用寓言拟合模型:
library(tsibble)
library(fable)
# Simulated data with same structure
df <- tsibble(
bcUI = rnorm(2557, 120, 50),
Date = seq(as.Date("2012-01-01"), by="1 day", length = 2557),
index= Date)
# Equivalent to auto.arima for a tsibble
fit <- df %>% model(ARIMA(bcUI))
第二,你想把经期改成什么,为什么?您有每日数据,因此它可能有每周模式(周期为 7)和年度模式(周期为 365)。日常数据的其他季节性时段极为罕见。 ARIMA()
函数会自动检查周期 7 是否存在明显的季节性。它不会寻找周期 365 季节性,因为这样的较长周期最好以季节性 ARIMA 模型以外的方式处理。
有关在 ARIMA 模型中处理年度和每周季节性周期的讨论,请参阅 https://otexts.com/fpp3/complexseasonality.html#complexseasonality。
我有一个时间序列(tsibble 对象),我需要应用 auto.arima
函数来查找我的模型。该对象在 7 年内以每天的频率出现
# A tsibble: 2,557 x 2 [1D]
bcUI Date
<dbl> <date>
1 13.6 2012-01-01
2 36.0 2012-01-02
3 33.7 2012-01-03
4 200. 2012-01-04
5 150. 2012-01-05
6 230. 2012-01-06
7 79.7 2012-01-07
8 65.7 2012-01-08
9 25.5 2012-01-09
10 35.7 2012-01-10
# ... with 2,547 more rows
当我应用函数时
autoarima1<-auto.arima(bctsibble,trace = TRUE,approximation = FALSE,seasonal = TRUE)
结果出现的频率为 7:
Best model: ARIMA(1,0,0)(2,0,0)[7] with non-zero mean
如何更改此频率?数据太大,无法全部共享。谢谢!
首先,您有一个 tsibble
对象,因此您应该使用寓言包进行自动 ARIMA 建模。 forecast 包中的 auto.arima()
函数是为 ts
对象设计的。以下是如何使用寓言拟合模型:
library(tsibble)
library(fable)
# Simulated data with same structure
df <- tsibble(
bcUI = rnorm(2557, 120, 50),
Date = seq(as.Date("2012-01-01"), by="1 day", length = 2557),
index= Date)
# Equivalent to auto.arima for a tsibble
fit <- df %>% model(ARIMA(bcUI))
第二,你想把经期改成什么,为什么?您有每日数据,因此它可能有每周模式(周期为 7)和年度模式(周期为 365)。日常数据的其他季节性时段极为罕见。 ARIMA()
函数会自动检查周期 7 是否存在明显的季节性。它不会寻找周期 365 季节性,因为这样的较长周期最好以季节性 ARIMA 模型以外的方式处理。
有关在 ARIMA 模型中处理年度和每周季节性周期的讨论,请参阅 https://otexts.com/fpp3/complexseasonality.html#complexseasonality。