This document is a brief tutorial to the matlab programs and data used to estimate the parameters of the deep-habit model and  produce empirical and theoretical impulse responses in the paper ``Explaining the Effects of Government Spending Shocks on Consumption and the Real Exchange Rate,''' by M. Ravn, S. Schmitt-Grohe, and M. Uribe, November 2011, forthcoming in the Journal of Monetary Economics. 

Software Requirement: A requirement for running this package is  the Matlab Code for First- and Second-Order Accurate Solutions to DSGE Models prepared by S. Schmitt-Grohe and Martin Uribe and available at:
http://www.columbia.edu/~mu2166/2nd_order.htm

To produce figure 1 in  the paper, run
plotir.m
The output of this program is a   plot of the  theoretical and empirical impulse responses and a two-std error band around the latter

Before running this program,  run the following two programs in the given order:
(1) estimate_var.m 
This program estimates the empirical model. To reproduce fig 1 in the apper,  provide no input arguments
(2) model.m 
This program produces analytical derivatives of the equilibrium conditions of the two-country deep-habit model
(3)  estimate_model.m 
This program estimates the parameters of the deep-habit model. It takes 67 iterations to complete; slightly less than 3 hours in a top-of-the line Dell desktop computer in 2011).