[R-SIG-Finance] How to retrieve standard errors of cointegrating vector from vars/urca ?
paulofel
paulofel at hotmail.com
Sat Mar 8 01:53:08 CET 2014
The code is available at http://www.jstatsoft.org/v27/i04/.
###################################################
### VECM r = 1
###################################################
vecm <- ca.jo(Canada[, c("rw", "prod", "e", "U")], type = "trace", ecdet =
"trend", K = 3, spec = "transitory")
vecm.r1 <- cajorls(vecm, r = 1)
##
## Calculation of t-values for alpha and beta
##
alpha <- coef(vecm.r1$rlm)[1, ]
names(alpha) <- c("rw", "prod", "e", "U")
alpha
beta <- vecm.r1$beta
beta
resids <- resid(vecm.r1$rlm)
N <- nrow(resids)
sigma <- crossprod(resids) / N
## t-stats for alpha (calculated by hand)
alpha.se <- sqrt(solve(crossprod(cbind(vecm at ZK %*% beta, vecm at Z1)))[1, 1] *
diag(sigma))
names(alpha.se) <- c("rw", "prod", "e", "U")
alpha.t <- alpha / alpha.se
alpha.t
## Differ slightly from coef(summary(vecm.r1$rlm))
## due to degrees of freedom adjustment
coef(summary(vecm.r1$rlm))
## t-stats for beta
beta.se <- sqrt(diag(kronecker(solve(crossprod(vecm at RK[, -1])),
solve(t(alpha) %*% solve(sigma) %*% alpha))))
beta.t <- c(NA, beta[-1] / beta.se)
names(beta.t) <- rownames(vecm.r1$beta)
beta.t
--
View this message in context: http://r.789695.n4.nabble.com/How-to-retrieve-standard-errors-of-cointegrating-vector-from-vars-urca-tp4655136p4686477.html
Sent from the Rmetrics mailing list archive at Nabble.com.
More information about the R-SIG-Finance
mailing list