Obtaining impulse response for a variable outside the model

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!

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)

Thanks for this helpful suggestion!

Be careful about your definition of variables. If they are in logs, you cannot use the output formula for levels.

Thanks. Yes, the model I have is linearized (not log-linearized).

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)

  1. 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!!

Please provide the file to replicate the issue.

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!
test_jr.mod (5.15 KB)

Your code should most probably be

//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);

Thanks Johannes, much appreciated!