我正在尝试为日常销售运行auto.arima
模型。我在模型中有许多预测变量。当我运行auto.arima
时,AIC会使用预测值显着降低值。例如:
auto.arima (sales,xreg=xreg)
但是当我尝试实际获得预测时,模型不会运行。
例如:salesforecast=auto.arima(sales,xreg=xreg)
R超时或不产生任何结果。有没有办法在模型中输入所有预测变量而不会导致它没有超时?
代码如下。
salests=ts(sales,frequency=365.25,start=c(2010,1))
xreg=cbind(Vars=model.matrix(~as.factor(data$Sunday)),Friday=data$Friday,Pub20=data$Public.20.10,Sale1=data$Sale.Last.for.1,Sale2=data$Sale.Last.for.2,Sale3=data$Sale.Last.for.3,Sale4=data$Sale.Last.for.4,Sale5=data$Sale.Last.for.5,Sale6=data$Sale.Last.for.6,Sale7=data$Sale.Last.for.7,Sale8=data$Sale.Last.for.8,Sale9=data$Sale.Last.for.9,Sale10=data$Sale.Last.for.10,OneBef=data$X1.Day.before.Sale,TwoBef=data$X2.Day.before.Sale,ThreeBef=data$X3.Day.before.Sale,FourBef=data$X4.Day.before.Sale,FiveBef=data$X5.Day.before.Sale,Monday=data$Monday,Tuesday=data$Tuesday,Wednesday=data$Wednesday,Thursday=data$Thursday,Jan=data$Jan,Feb=data$Feb,Mar=data$Mar,Apr=data$Apr,May=data$May,Jun=data$Jun,Jul=data$Jul,Aug=data$Aug,Sep=data$Sep,Oct=data$Oct,Nov=data$Nov)
xreg=xreg[,-1]
colnames(xreg)=c("Sunday","Friday","Pub20","Sale1","Sale2","Sale3","Sale4","Sale5","Sale6","Sale7","Sale8","Sale9","Sale10","OneBef","TwoBef","ThreeBef","FourBef","FiveBef","Monday","Tuesday","Wednesday","Thursday","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov")
salesforecast=auto.arima(sales,xreg=xreg)