time series - vars package of R - AIC after restrict -
i fit vector autoregression model on canada data in vars package , restrict based on t-value of 1.64.
library(vars) data("canada") var.can1 <- var(canada, p = 2, type = "none") summary(var.can1) var estimation results: ========================= endogenous variables: e, prod, rw, u deterministic variables: none sample size: 82 log likelihood: -184.045 roots of characteristic polynomial: 1 0.9783 0.9113 0.9113 0.7474 0.1613 0.1613 0.1572 call: var(y = canada, p = 2, type = "none") # aic bic etc. varselect(canada, lag.max = 2, type = "none")$criteria var.can2 <- restrict(var.can1, method = "ser", thresh = 1.64) summary(var.can2) var estimation results: ========================= endogenous variables: e, prod, rw, u deterministic variables: none sample size: 82 log likelihood: -191.376 roots of characteristic polynomial: 1 0.9742 0.9272 0.9272 0.7753 0.2105 0.2105 0.005071 call: var(y = canada, p = 2, type = "none")
i want obtain revised information criteria, cannot see way this. know how?
edit 1
so try derive aic unrestricted model:
vars::varselect(canada, lag.max = 2, type = "none")$criteria 1 2 aic(n) -5.600280680 -6.082112784 hq(n) -5.411741957 -5.705035337 sc(n) -5.130676924 -5.142905272 fpe(n) 0.003697972 0.002289041 s <- summary(var.can1) s$covres e prod rw u e 0.140560073 0.0056629572 -0.03893668 -0.0798565366 prod 0.005662957 0.4358209615 0.06689687 -0.0005118419 rw -0.038936678 0.0668968657 0.60125872 0.0309232731 u -0.079856537 -0.0005118419 0.03092327 0.0899478736
from new introduction multiple time series analysis luetkepohl, helmut 2007, pg 147:
$$aic(m) = ln(det(covres)) + \frac{2mk^2}{t}$$
m lag order, k number of series, t sample size
but get:
-6.451984 + 2*2*4^2/84 = -5.69
which not equal -5.600280680
digging around in code find residual covariance matrix reported in summary not used compute aic.
pretty frustrating, bug.
library(vars) data("canada") var.can1 <- var(canada, p = 2, type = "none") s <- summary(var.can1) # variance covariance matrix resid s$covres # e prod rw u # e 0.140560073 0.0056629572 -0.03893668 -0.0798565366 # prod 0.005662957 0.4358209615 0.06689687 -0.0005118419 # rw -0.038936678 0.0668968657 0.60125872 0.0309232731 # u -0.079856537 -0.0005118419 0.03092327 0.0899478736 vars::varselect(canada, lag.max = 2, type = "none")$criteria # aic defined as: # aicm = ln(det(sigma)) + (2pk^2)/n # p = lag order, k = num series p <- 2 k <- 4 n <- nrow(canada) - p (aic1 <- log(det(s$covres)) + (2*2*4^2)/n) # [1] -5.671496 nothing -6.082112784 # residual covariance matrix # reported in summary not used # compute aic. myresid <- residuals(var.can1) (mysigma <- crossprod(myresid) * (1/n)) # e prod rw u # e 0.12684690 0.0051104797 -0.03513798 -0.0720656604 # prod 0.00511048 0.3933018507 0.06037034 -0.0004619127 # rw -0.03513798 0.0603703437 0.54259933 0.0279063671 # u -0.07206566 -0.0004619127 0.02790637 0.0811724773 log(det(mysigma)) + (2* p * k^2)/n # [1] -6.082113, -6.082112784
Comments
Post a Comment