使用来自不同数据的auto.arima的参数对数据运行ARIMA模型

时间:2014-09-18 14:32:49

标签: r parameters

我想获取完整数据模型的参数,然后使用这些参数针对“样本内”'运行模型。数据,但我不知道如何做到这一点。

例如;

data<-c(79160.56266,91759.73029,91186.47551,106353.8192,70346.46525,80279.15139,82611.60076,131392.7209,93798.99391,105944.7752,103913.1296,154530.6937,110157.4025,117416.0942,127423.4206,156751.9979,120097.8068,121307.7534,115021.1187,150657.8258,113711.5282,115353.1395,112701.9846,154319.1785,116803.545,118352.535)
data<-ts(data,delta=1/4,start=c(8,1))
data<-log(data)
auto.arima(data,max.D=3,d=1,seasonal=TRUE,allowdrift=FALSE,stepwise=FALSE,trace=TRUE,seasonal.test="ch")

我需要提取此参数/顺序以对此数据运行arima,强制参数与提取的参数相同:

data2<-head(data,-4)
#arimab<-Arima(data2,order=order from auto.arima on full data)
#forecast(arimab,h=8,simulate=TRUE,fan=TRUE)

有人可以建议如何首先提取auto.arima的参数,然后如何在&#39; data2&#39;上运行模型。用这些参数。

1 个答案:

答案 0 :(得分:4)

我想我现在已经弄清楚了......

data<-c(79160.56266,91759.73029,91186.47551,106353.8192,70346.46525,80279.15139,82611.60076,131392.7209,93798.99391,105944.7752,103913.1296,154530.6937,110157.4025,117416.0942,127423.4206,156751.9979,120097.8068,121307.7534,115021.1187,150657.8258,113711.5282,115353.1395,112701.9846,154319.1785,116803.545,118352.535)
data<-ts(data,delta=1/4,start=c(8,1))
data<-log(data)
aaw<-auto.arima(data,max.D=3,d=1,seasonal=TRUE,allowdrift=FALSE,stepwise=FALSE,trace=TRUE,seasonal.test="ch")
orderWA<-c(aaw$arma[1], aaw$arma[6] , aaw$arma[2])
orderWS <- c(aaw$arma[3], aaw$arma[7] , aaw$arma[4])

data2<-head(data,-4)
arimaa<-Arima(data2,order=orderWA,seasonal=orderWS,method="ML")