R语言中有关预测

Python025

R语言中有关预测,第1张

ARIMA有现成的东西

nobs=length(data_set)

fit=arima(data_set, order=c(1,1,1), xreg=1:nobs)

fore=predict(fit, 15, newxreg=(nobs+1):(nobs+15))

arima 是fit模型

predict 是预测

ts.plot 是按时间画图

好吧。。。希望对你有用~~~~~~~~~~~~~

predict(model,newdata)

model是你的模型,把新的自变量按照变量名放在一个data frame里(newdata),比如newdata<-data.frame(x1,x2,x3,x4,x5)