Page 1 of 1
Obtaining impulse response for a variable outside the model
Posted:
Fri Mar 27, 2015 11:03 am
by jrubin
I'm working with a simple RBC model specified specified in levels so that Dynare linearizes it.
I already know the solutions for capital (K) and labour (L).
The output (Y) equation is not specified in the set of model equations as Y was substituted out.
How can I obtain the impulse response of Y without adding it to the model equations since I don't need the first order approximation to Y as I already know K and L?
Any suggestion will be much appreciated!
Re: Obtaining impulse response for a variable outside the mo
Posted:
Fri Mar 27, 2015 11:20 am
by Daniel Bendel
I would do the following:
Y is computed by using the production function Y= K^(1-alpha)*L^(alpha).
From your model you get the irf for K and L and the corresponding steady state values save in oo_.steady_state().
Then just use these values to calculate the irf for Y:
Y_irf = (K_eps_YOURSHOCK + oo_.steady_state(HERE THE NUMBER WHERE DYNARE HAS SAVED THE SS FOR K).*ones(size(K_eps_YOURSHOCK)))^(1-alpha)* (L_eps_YOURSHOCK + oo_.steady_state(HERE THE NUMBER WHERE DYNARE HAS SAVED THE SS FOR L).*ones(size(L_eps_YOURSHOCK)))^(alpha)
Re: Obtaining impulse response for a variable outside the mo
Posted:
Fri Mar 27, 2015 11:47 am
by jrubin
Thanks for this helpful suggestion!
Re: Obtaining impulse response for a variable outside the mo
Posted:
Fri Mar 27, 2015 1:47 pm
by jpfeifer
Be careful about your definition of variables. If they are in logs, you cannot use the output formula for levels.
Re: Obtaining impulse response for a variable outside the mo
Posted:
Fri Mar 27, 2015 4:56 pm
by jrubin
Thanks. Yes, the model I have is linearized (not log-linearized).
Re: Obtaining impulse response for a variable outside the mo
Posted:
Sat Mar 28, 2015 11:13 am
by jrubin
Hello Daniel and Johannes:
1. Seems there is an error in the expression: should coefficients be .^(1-alpha) and .^(alpha)?
2. Is the product of the two terms involving K and L conformable to give Y_irf of dimension size(K_eps_YOURSHOCK) x 1?
Y_irf = (K_eps_YOURSHOCK + oo_.steady_state(HERE THE NUMBER WHERE DYNARE HAS SAVED THE SS FOR K).*ones(size(K_eps_YOURSHOCK)))^(1-alpha)* (L_eps_YOURSHOCK + oo_.steady_state(HERE THE NUMBER WHERE DYNARE HAS SAVED THE SS FOR L).*ones(size(L_eps_YOURSHOCK)))^(alpha)
3. If Y=AK^(1-alpha)*L^(alpha), where A is the AR(1) shock, then one need to multiply the expression above with (A_eps_YOURSHOCK +oo_.steady_state(HERE THE NUMBER WHERE DYNARE HAS SAVED THE SS FOR A))?
Thanks, again!!
Re: Obtaining impulse response for a variable outside the mo
Posted:
Sat Mar 28, 2015 11:47 am
by jpfeifer
Please provide the file to replicate the issue.
Re: Obtaining impulse response for a variable outside the mo
Posted:
Sat Mar 28, 2015 12:31 pm
by jrubin
Please see the attached file.
Lines 166 is the output expression.
My attempt based on the above suggestion is in lines 170-176.
Thanks, once again!
Re: Obtaining impulse response for a variable outside the mo
Posted:
Sun Mar 29, 2015 9:23 am
by jpfeifer
Your code should most probably be
- Code: Select all
//Constructing the irf for Output and M for the A1 (technology) shock:
Y1_irf_A1 = (K_t0_eps_A1 + oo_.steady_state(strmatch('K_t0',M_.endo_names,'exact'))).^(1-alpha);
Y2_irf_A1 = (U_t0_eps_A1 + oo_.steady_state(strmatch('U_t0',M_.endo_names,'exact'))).^(1-alpha);
Y3_irf_A1 = A1_t0_eps_A1 + oo_.steady_state(strmatch('A1_t0',M_.endo_names,'exact'));
Y4_irf_A1 = (1-d0)-(d2*(X_t0_eps_A1 + oo_.steady_state(strmatch('X_t0',M_.endo_names,'exact')))+d1*(X_t0_eps_A1 + oo_.steady_state(strmatch('A1_t0',M_.endo_names,'exact'))));
Y_irf_A1 = Y1_irf_A1.*Y2_irf_A1.*Y3_irf_A1.*Y4_irf_A1;
M_irf_A1 = 1 -(mu_t0_eps_A1 + oo_.steady_state(strmatch('mu_t0',M_.endo_names,'exact'))).*Y_irf_A1.^(1-gamma);
Re: Obtaining impulse response for a variable outside the mo
Posted:
Sun Mar 29, 2015 2:19 pm
by jrubin
Thanks Johannes, much appreciated!