我正在尝试运行以下代码,以使用 ARDL 模型进行预测。但是,我收到的输出给了我下面的错误。将不胜感激的指导。谢谢你。
代码如下供参考
1. Set up Train Set Data
cutoffYearStart <- 1947.75
cutoffYearEnd <- 2016.75
TrainData <- Data[which(Data$Time>=cutoffYearStart & Data$Time<=cutoffYearEnd),]
attach(TrainData)
2. Set up Test Set Data
cutoffYearStart <- 2017.75
cutoffYearEnd <- 2018.75
TestData <- Data[which(Data$Time>=cutoffYearStart & Data$Time<=cutoffYearEnd),]
attach(TestData)
3. Run Model and Forecast
Matrix<-data.matrix(TestData[,c(3,5,15,21)], rownames.force = NA)
model.ardlDlm1= ardlDlm(Real_GDP_Ann_Lvl~Scientific_and_Technical_Journal_Articles_Ann_Yoy+Total_Investment_Ann_Lvl+Employment_Ann_Yoy,data=TrainData,p=1,q=1)
summary(model.ardlDlm1)
ForecastResult<-forecast(model.ardlDlm1, Matrix, h = 4 , interval = TRUE, level = 0.95 , nSim = 500)
输出:预测结果
as.vector(coefs) %*% obs 中的错误:参数不一致