我在r中使用tbats()函数来创建预测模型。
我想知道是否有人知道如何手动将ARMA(p,q)直接传递给tbats()函数?
编辑:如果问题含糊不清,我道歉。在包的文档中,打印以下参数说明:
"为错误选择ARMA(p,q)模型时要传递给auto.arima的其他参数。 (请注意,xreg将被忽略,关于季节性和差异的任何参数都会被忽略,但是将使用控制p和q值的参数。)"
它清楚地表明手动控制ARMA(p,q)可以通过直接传递给tbats()函数的参数来完成。有谁知道怎么做?
https://www.rdocumentation.org/packages/forecast/versions/7.3/topics/tbats
答案 0 :(得分:0)
很快,你不能。
tbats
是一种混合算法,因此您不应该考虑使用它来构建ARMA模型。 tbats函数通过布尔参数use.arma.errors=TRUE/FALSE
自动应用arma错误项,这会尝试更好地建模残差。
如果您想构建ARIMA模型,可以使用预测包中的auto.arima。
关于auto.arima
的示例auto.arima(USJudgeRatings[,1], ic='aicc', stepwise=FALSE, start.p=3, start.q=1, max.p=3, max.q=3)
有关tbats的示例
omega<-USJudgeRatings[,1];p<-10; q<-2; phi<-3;
tbats(omega, p,q, phi,use.arma.errors=TRUE)
BATS(0, {0,0}, 0.979, -)
Call: tbats(y = omega, use.box.cox = p, use.trend = q, use.damped.trend = phi,
use.arma.errors = TRUE)
Parameters
Lambda: 0
Alpha: -0.04239053
Beta: 0.04362955
Damping Parameter: 0.978616
Seed States:
[,1]
[1,] 1.917976
[2,] 0.017468
Sigma: 0.1206409
AIC: 163.774
我的参数p,q和phi代表use.box.cox,use.trend和use.damped.trend。
更多信息
答案 1 :(得分:0)
Class ttl Total_Male Total_Female Total_Present Total_Male_Present Total_Female_Present Total_Absent Total_Male_Absent Total_Female_Absent
------ ----------- ----------- ------------ ------------- ------------------ -------------------- ------------ ----------------- -------------------
KG 4 2 2 2 1 1 2 1 1
NUR 4 2 2 2 1 1 2 1 1
的{{1}}参数将从文档(...
)传递到tbats
auto.arima
查看?tbats
的文档,我们发现有关于为...: Additional arguments to be passed to ‘auto.arima’ when
choose an ARMA(p, q) model for the errors. (Note that
xreg will be ignored, as will any arguments concerning
seasonality and differencing, but arguments controlling
the values of p and q will be used.)
和auto.arima
设置值的参数。
p
因此,对于您正在进行的工作,将参数q
, auto.arima(y, d = NA, D = NA, max.p = 5, max.q = 5, max.P = 2,
max.Q = 2, max.order = 5, max.d = 2, max.D = 1, start.p = 2,
start.q = 2, start.P = 1, start.Q = 1, stationary = FALSE,
seasonal = TRUE, ic = c("aicc", "aic", "bic"), stepwise = TRUE,
trace = FALSE, approximation = (length(x) > 150 | frequency(x) > 12),
truncate = NULL, xreg = NULL, test = c("kpss", "adf", "pp"),
seasonal.test = c("ocsb", "ch"), allowdrift = TRUE, allowmean = TRUE,
lambda = NULL, biasadj = FALSE, parallel = FALSE, num.cores = 2,
x = y, ...)
和start.p
添加到start.q
调用以控制起始值并查看搜索范围。
在此示例中,最佳模型为trace
。 tbats
告诉我们ARIMA(0, 0, 0) with zero mean
的值已被选中。
BATS(0, {0,0}, 0.979, -)