R 多元时间序列的向量自回归模型:趋势和季节性
我有3个时间序列,我想预测每个时间序列的未来值。 我在用!包装在R 这就是方法:R 多元时间序列的向量自回归模型:趋势和季节性,r,time-series,R,Time Series,我有3个时间序列,我想预测每个时间序列的未来值。 我在用!包装在R 这就是方法: 分解乘法时间序列,去掉趋势、季节性和随机部分 time_series1_components = decompose(time_series1,type="mult") 对所有时间序列执行此操作 对随机部分应用VAR模型,并预测未来值: random_part1 = time_series1_components$random random_part2 = time_series2_components$ran
time_series1_components = decompose(time_series1,type="mult")
random_part1 = time_series1_components$random
random_part2 = time_series2_components$random
random_part3 = time_series3_components$random
merged_df = ts.union(random_part1, random_part2,random_part3, dframe = TRUE)
merged_mat <- data.matrix(merged_df)
merged_mat = na.exclude(merged_mat)
checklag = VARselect(merged_mat)
EstimateModel=VAR(merged_mat, p = 2, type = "const", season = NULL, exogen = NULL)
summary(EstimateModel)
roots(EstimateModel)
predict(EstimateModel)`
random\u part1=时间序列1\u组件$random
random_part2=时间序列2_组件$random
random\u part3=时间序列3\u组件$random
合并的df=ts.union(随机部分1,随机部分2,随机部分3,dframe=TRUE)
我不知道VARS
软件包,但是你可以看看forecast
软件包,特别是auto.arima
,然后是forecast
,这是另一种省力的方法。谢谢你的快速回复。时间序列1的未来值受其自身的过去值以及时间序列2和时间序列3的过去值的影响。所以我想我需要使用向量自回归模型。我在预测包中没有看到这一点。如果我错了,请纠正我。不,你是对的,forecast
不包括VAR模型的任何功能。