RATS 11.1
RATS 11.1

Procedures /

MONTEVAR Procedure

Home Page

← Previous Next →

@MonteVAR computes and graphs error bands for impulse response functions for a VAR using Monte Carlo simulation. This assumes the model is a symmetric VAR estimated using the ESTIMATE instruction. By default, @MONTEVAR does a Cholesky factorization, though it can easily be adapted to other situations by using the FFUNCTION option to provide a function to compute an alternative factorization.

This combines the functions of @MCVARDODRAWS and @MCGRAPHIRF for simple models. If you need more options (for instance, more flexibility on the graphs), use those.

@MonteVAR( options  )

Options

MODEL=model to analyze [required]

You must have just estimated this.

 

STEP=number of response steps[48]

DRAWS=number of Monte Carlo draws[1000]

 

FFUNCTION=FUNCTION[RECT](SYMM,MODEL) [not used]

This must be a FUNCTION which returns an alternate factorization (rather than the Cholesky) using the draw for the covariance matrix (first argument in the function) and the model (second argument). Note that this is only technically correct if the factorization involves a just-identified model. An overidentified model requires more complicated methods.

 

   FACTOR=RECT matrix of shocks [not used]

This is an alternative to FFUNCTION if you are inputting shocks which are a fixed matrix (such as unit shocks). Note that, despite the name, these are almost certainly not a "factor" matrix. An example is FACTOR=%UNITV(%NVAR,1) which does a single unit shock to variable 1.

 

SHOCKLABELS=VECT[STRINGS] of labels for the shocks [dependent variables of model]

VARLABELS=VECT[STRING] of labels for the variables [dependent variables of model]

HEADER="title for graph"

Example

open data m-ibmsp2608.txt

calendar(m) 1926:1

data(format=prn,org=columns) 1926:01 2008:12 date ibm sp

*

* Transform to log return percentages

*

set ibm = 100.0*log(ibm+1)

set sp  = 100.0*log(sp+1)

*

* Using AIC to examine models

*

@varlagselect(lags=6,crit=aic)

# ibm sp

*

system(model=full)

variables ibm sp

lags 1

det constant

end(system)

estimate(resids=resids)

*

* This does impulse responses with error bands using Monte Carlo

* integration. You'll note an apparent difference with the response of

* IBM to SP500 compared with that in the book. However, that is due to a

* difference in the scale of the graph. Graphing responses of IBM to the

* two shocks with different scales exaggerates the effect of the SP500

* shock.

*

@montevar(model=full,steps=6,header="IRF's with Error Bands")

Sample Graph

This is (admittedly) a rather uninteresting graph since it's for a pair of return series with very little serial correlation. The shocks are in the columns and the response variables are in the rows. The responses of a variable are done in the same scale. As noted in the comments in the example, the book from which this was taken scaled each graph separately, which can make a trivial response like IBM to SP look large by comparison.


 

 


Copyright © 2026 Thomas A. Doan