How to pass exogenous variables in the function bvar
Hi, I have few exogenous variables in my dataset which are to be controlled for . Can the same be handled using bvar() as I haven't came across any arguments in the documents.
Regards Arnab
Hey,
You can do this manually by using the Frisch-Waugh-Lovell theorem. Here's some code for a univariate model (variables are the ones not to factor out):
Q_fwl <- qr.Q(qr(X[, -variables, drop = FALSE]))
y <- y - Q_fwl %*% crossprod(Q_fwl, y)
X <- X[, variables, drop = FALSE] - Q_fwl %*%
crossprod(Q_fwl, X[, variables, drop = FALSE])
Hi Nikolas,
I have few queries on the same . If I’m not wrong applying FRW would also mean transformation of Y(endogenous variables) and the variance covariance matrix of residuals . The posterior draws will be conditional on these transformed variables . Moreover, how do I interpret IRF , FEVD ? if these are done on the transformed variables .
So, I will have to multiply back the orthogonal projection matrix again before doing FEVD or IRF , but how to accommodate the same with your function especially if I want to impose some sign restrictions.
If the above concern can be addressed , I was thinking for doing the multiplier analysis for my exogenous variables , for the same I will have to compute back the coefficients for the exogenous variables .
Regards Arnab
Hey Arnab,
Yes, for a VAR you basically just need to transform Y and feed it into bvar. The posterior draws will effectively be draws from a VARX (albeit a bit hacky, since you'd just be using the posterior mean for FWL), so the coefficients are already in the form you want them (see Wiki). Correct me if I'm wrong, but that should mean that IRF (and FEVD) work out of the box.
Best,
The impulse response would depend upon the matrix derived from Cholesky decomposition of Var-Covar matrix . The sign restrictions will be based on this matrix . Will the Cholesky decomposition be same in case of FVW transformation of residual matrix? I'm not quite sure on this
So in a VARX in general the IRF work the same way (see e.g.). There the concept is the same to FWL ,so I don't see why it'd impact the VCOV matrix (and hence the Cholesky). Conceptually we're removing the correlation with X from all Y. This may impact the correlation between y_1 and y_2, but this is spurious anyways and exactly why you want a VARX.
Y = X1 beta1 +X2 beta2 +u , X1 and X2 are independent and let X2 be the set of endogenous variables . Now
Mx1 Y1 =. Mx1X2beta2 +Mx1u , where Mx1 is the annihilator matrix. Wouldn't the expressions which one will get after converting to MA representation of VAR contain the Mx1 term as coefficient of errors .......
No my mistake , Mx1 term should not factor thanks
yes it will help in estimation of multiplier analysis for exogenous variables . Once again thanks