Uhlig JME 2005 |
This is a set of replication files for Uhlig(2005). This extracts a monetary policy shock from a six-variable VAR based upon sign-restrictions on the responses of the variables. It uses two different approaches:
1.a rejection method of drawing shocks then rejecting those that fail to meet the sign restrictions
2.a penalty function approach which severely penalizes responses which have the wrong sign.
This has five separate programs
UHLIG1.RPF
This generates Uhlig's figures 2 and 3, which look at the results of generating "monetary policy" shocks using only the least squares estimates for the VAR.
UHLIG2.RPF
This uses the rejection method (or "pure sign restriction" approach) to generate impulse responses and contribution to forecast error variance for the monetary policy shock.
UHLIG3.RPF
This is similar to UHLIG2.RPF but uses the penalty function approach.
UHLIG2 WITH HISTORY.RPF
This uses the same basic setup as UHLIG2.RPF, but generates the historical effects of the policy shocks. (Not included in the original paper). Note that the bands for these tend to get very wide as the horizon increases.
UHLIG2 WITH SHOCKS.RPF
This uses the same basic setup as UHLIG2.RPF, but generates the observed values of the shocks. (Not included in the original paper). The bands on these also tend to be rather wide.
Adapting to a Different Model
The following describes the VAR; in Uhlig's case, a six variable model with 12 lags. Change that as needed.
system(model=varmodel)
variables gdpc1 gdpdef cprindex fedfunds bognonbr totresns
lags 1 to 12
end(system)
estimate(noprint)
These are used to label the dependent variables in the graphs. Again, change as needed.
dec vect[strings] vl(6)
compute vl=||"real GDP","GDP price defl","Comm. Price Ind.",$
"Fed Funds Rate","Nonborr. Reserv.","Total Reserves"||
These are the control parameters for the rejection method programs. N1 and N2 control the draws, N1 limiting the number of "outer" draws which draw the coefficients and covariance matrix, N2 limiting the number of "inner" or "sub" draws which try different impulse vectors. NKEEP is the number of valid draws that you want. Note that these do up to 40000=N1*N2 trial impulse vectors. If you don't get NKEEP that pass your restrictions, you will get a warning message. Don't ignore it—if the number of acceptances is that low, you may be trying to restrict the shocks too much.
NSTEP is the number of impulse steps you want to compute. This has nothing to do with the number that you want to restrict. This shouldn't be unreasonably high. With monthly data, 60 is five years' worth. It would be fifteen years' worth with quarterly data, which probably is too many to be computed reliably.
KMIN and KMAX control the (1-based) horizons that are subject to sign restrictions. Note that Uhlig uses 0-based, so his 0 to 5 is 1 to 6 here.
compute n1=200
compute n2=200
compute nkeep=1000
compute nvar=6
compute nstep=60
compute KMIN=1
compute KMAX=6
This is the "working" criterion for determining whether a shock is accepted.
if UhligAccept(a,KMIN,KMAX,||+4,-3,-2,-5||)==0
goto reject
The +4 means that the response of the 4th variable in the VAR (FedFunds) is constrained to be positive (more precisely, non-negative), the -3 means that the response of the 3rd variable (commodity price index) is constrained to be negative, similarly for the last two. The test shock has to create responses of the proper signs on each of those variables.
This type of model is covered in considerable detail as part of the Vector Autoregressions e-course.
Common Errors
The most common errors are the ones which prevent the model from generating enough draws which meet the restrictions. One is restrictions which aren't unreasonable in sign, but constrain too many steps. For instance, if you constrain more than a year out, you may have trouble getting draws which meet that for each step. Another has constraints which are seemingly contradictory—one interest rate up, another down, for instance. Obviously, it's very important to make sure that your acceptance criterion in the "UhligAccept" line is correct.
Extensions
For multiple sign-restricted shocks or shocks with exact zero restrictions, see Mountford and Uhlig(2009).
Copyright © 2025 Thomas A. Doan