Mountford & Uhlig JAE 2009 replication files
The attached zip file has replication files for Mountford & Uhlig(2009), "What are the Effects of Fiscal Policy Shocks?", Journal of Applied Econometrics (to appear). mu2009b1.prg does the analysis with 4 period sign constrained shocks, including the combination shocks to do the various forms of fiscal policy experiments. mu2009b2.prg does the analysis with "delayed" responses. There's a common source file with the set up code for the model.
To (greatly) simplify the code, we wrote a function which computes the "penalty function" for responses based upon the sign constraints.
This also uses a different method for handling the minimization of the penalty function than was done in the program for the Uhlig JME 2005 paper. Instead of doing each optimization twice, then rejecting draws where the modes don't match up, it does a slower broad scan with the genetic algorithm as the preliminary method, which seems in practice to find the global optimum with very high reliability. With this (fairly large) model, it's able to do 250 draws in about five minutes, which is much faster than the Gauss code provided by the authors.
To (greatly) simplify the code, we wrote a function which computes the "penalty function" for responses based upon the sign constraints.
- Code: Select all
*
* UhligPenalty(q,first,last,constrained) returns the penalty function
* for the weight vector <<q>> (applied to the impulse responses in the
* global VECT[SERIES] impulses). <<first>> and <<last>> are the range of
* responses constrained (1 = impact response). <<constrained>> is a
* VECT[INTEGER] with the variable positions being constrained. Use +slot
* for a positivity constraint and -slot for a negativity constraint.
* That is, if you want the first 4 responses to be positive on the 2nd
* variable and negative on the third, you would use the function
*
* UhligPenalty(q,1,4,||2,-3||)
*
function UhligPenalty q first last constrained
type real UhligPenalty
type vector q
type integer first last
type vect[int] constrained
*
local integer i k
local real func
local vector ik
*
compute func=0.0
do k=first,last
compute ik=(%xt(impulses,k)*q)./scales
do i=1,%rows(constrained)
if constrained(i)<0
compute value= ik(-constrained(i))
else
compute value=-ik(constrained(i))
compute func=func+%if(value<0.0,value,100*value)
end do i
end do k
compute UhligPenalty=func
end
This also uses a different method for handling the minimization of the penalty function than was done in the program for the Uhlig JME 2005 paper. Instead of doing each optimization twice, then rejecting draws where the modes don't match up, it does a slower broad scan with the genetic algorithm as the preliminary method, which seems in practice to find the global optimum with very high reliability. With this (fairly large) model, it's able to do 250 draws in about five minutes, which is much faster than the Gauss code provided by the authors.