MCVARDoDraws - Procedure for drawing IRF's by Monte Carlo
The attached is a procedure which was largely taken out of the MonteVar procedure. This does the draws only, leaving the graphing and other analysis to other procedures (particularly MCGraphIRF).
MCVARDoDraws does a Choleski factorization, though it can easily be adapted to other situations. Its options are:
MODEL=model to analyze [required, should already be estimated]
STEPS=number of response steps[48]
DRAWS=number of Monte Carlo draws[1000]
ACCUMULATE=list of variables (by position) to accumulate [none]
The ACCUMULATE option allows you to estimate the VAR in differences, then convert the impulse responses to the responses of the levels. For instance, ACCUMULATE=||1|| will "undifference" the 1st variable.
MCVARDoDraws defines the global %%responses in the format used by MCGraphIRF and some other procedures. It does not directly produce any output.
Minor revision 8 April 2011
If you want to replace the Choleski factorization with some other one, that is done at the following location in the procedure. We would recommend that you first make a renamed copy of the procedure file before editing:
Instead of factor=fsigmad, you want factor = whatever your factor matrix is. An example is the following, which uses a factorization with short and long-run restrictions:
The LR and SR matrices need to be passed into the procedure in some way; adding them as options to your new procedure is probably the best way to handle that. So you would include the following among the options:
MCVARDoDraws does a Choleski factorization, though it can easily be adapted to other situations. Its options are:
MODEL=model to analyze [required, should already be estimated]
STEPS=number of response steps[48]
DRAWS=number of Monte Carlo draws[1000]
ACCUMULATE=list of variables (by position) to accumulate [none]
The ACCUMULATE option allows you to estimate the VAR in differences, then convert the impulse responses to the responses of the levels. For instance, ACCUMULATE=||1|| will "undifference" the 1st variable.
MCVARDoDraws defines the global %%responses in the format used by MCGraphIRF and some other procedures. It does not directly produce any output.
Minor revision 8 April 2011
If you want to replace the Choleski factorization with some other one, that is done at the following location in the procedure. We would recommend that you first make a renamed copy of the procedure file before editing:
- Code: Select all
*
* The next line is where a particular factorization of sigmad is
* input into the calculation. This does the Choleski factorization in
* standard order, which is what is used above in drawing the
* coefficients.
*
compute factor=fsigmad
Instead of factor=fsigmad, you want factor = whatever your factor matrix is. An example is the following, which uses a factorization with short and long-run restrictions:
- Code: Select all
compute phiinv=inv(%modellagsums(model))
@ShortAndLong(lr=lr,sr=sr,masum=phiinv) sigmad factor
The LR and SR matrices need to be passed into the procedure in some way; adding them as options to your new procedure is probably the best way to handle that. So you would include the following among the options:
- Code: Select all
option rect LR
option rect SR