chili
2014-Jun-19 17:21 UTC
[R] Restrict a SVAR A-Model on Matrix A and Variance-Covariance-Matrix
Hello folks!
I'm using R-Package {vars} and I'm trying to estimate an A-Model.
I have serious problems regarding the restrictions.
1) My A-Matrix needs (!) to have the following form:
# 1 NA NA NA
# 0 1 NA NA
# 0 0 1 NA
# 0 0 0 1
That is done in R by:
A_Matrix <- diag(4) # main diagonal = 4 restrictions
A_Matrix [1, 2] <- NA #
A_Matrix [1, 3] <- NA #
A_Matrix [1, 4] <- NA #
A_Matrix [2, 3] <- NA #
A_Matrix [2, 4] <- NA #
A_Matrix [3, 4] <- NA # off diagonal = 6 restrictions
2) The Variance-Covariance-Matrix of the structural residuals needs (!) to
be looking like:
#
# var(X1) 0 0 0
# 0 var(X2) 0 0
# 0 0 var(X3) 0
# 0 0 0 var(X4)
Since cov(xy)=cov(yx) there are 6 more restrictions.
So in total I would have 4+6+6=16 restrictions. The SVAR would be just
identified.
My problem is that I don't know how to implement this
Variance-Covariance-Matrix within R and {vars}.
My Code so far is:
# Prediction SVAR - A-Model (B-Matrix = NULL)
# restrictions:
# 1) Amat = A_Matrix
# 2) ????
VAR.est <- VAR(data.ts, p = 4, type = "none")
SVAR.A.est <- SVAR(x=VAR.est, estmethod = "direct", Amat = A_Matrix
,
Bmat = NULL, hessian = TRUE, lrtest = TRUE)
#--------------------------------------------------------------------
I know, that {vars} restrict the Variance-Covariance-Matrix by default to an
identity-matrix but I wondered if I can't restrict it by myself since the
way I need (!) to do that is quite common.
Thank you for any comments. I'm quite desperate right now :/
--
View this message in context:
http://r.789695.n4.nabble.com/Restrict-a-SVAR-A-Model-on-Matrix-A-and-Variance-Covariance-Matrix-tp4692387.html
Sent from the R help mailing list archive at Nabble.com.
chili
2014-Jun-20 09:27 UTC
[R] {vars} SVAR A-Model: Restrictions on Matrix A and Variance-Covariance-Matrix
Thanks to Dennis Murphy I was able to improve mein R-Code:
1) A-Matrix:
A_Matrix <- diag(4) # 4 restrictions
A_Matrix[upper.tri(A_Matrix)] <- NA # 6 further restrictions
2) Variance-Covariance-Matrix
Xmat <- cbind(X1, X2, X3, X4)
vs <- apply(Xmat, 2, var)
VC_Matrix<- diag(vs) # final 6 restricions
That worked fine so far.
Now, is there any chance to implement the VC_Matrix it into my
SVAR-estimation?
--
View this message in context:
http://r.789695.n4.nabble.com/vars-SVAR-A-Model-Restrictions-on-Matrix-A-and-Variance-Covariance-Matrix-tp4692387p4692424.html
Sent from the R help mailing list archive at Nabble.com.