【问题标题】:fitted values Vars package in RR中的拟合值Vars包
【发布时间】: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


【解决方案1】:

参数p是滞后阶数,如果p = 2,且时间序列有84个观测值,那么VAR中使用的观测值一定是84 - 2 = 82

您可以更改p 看看会发生什么:

var.2c <- VAR(Canada, p = 1, type = "const")
fitted(var.2c)

var.2c$obs
# 83

https://www.rdocumentation.org/packages/vars/versions/1.5-2/topics/VAR

【讨论】:

    猜你喜欢
    • 2013-10-31
    • 1970-01-01
    • 2019-05-22
    • 2020-07-24
    • 2016-08-21
    • 2020-10-03
    • 1970-01-01
    • 2018-01-28
    • 2013-11-30
    相关资源
    最近更新 更多