【发布时间】:2018-03-17 09:05:59
【问题描述】:
我正在使用 R 中的 VARS 包和包本身中的数据集 Canada。我不明白拟合模型的数据点比加拿大实际时间序列少 2 个数据点的原因。加拿大时间序列的大小为 84*4,而拟合的时间序列大小为 82*4。我正在使用以下代码:
library(vars)
rm(list=ls(all=TRUE))
data(Canada)
#to plot the time series
par(mfrow=c(1, 1))
plot(Canada, plot.type="m", mar=c(gap=0.3, 5.1, gap=0.3, 2.1))
#VARselect used to get the order of the time series
VARselect(Canada, lag.max = 5, type="const")
#VAR(2) estimation
var.2c <- VAR(Canada, p = 2, type = "const")
fitted(var.2c)
【问题讨论】:
-
能否请您检查我的回答是否解决了您的问题。提前谢谢你。
标签: r time-series autoregressive-models