# Hours

Hello all,

I think that hours is always stationary in the model but I was wondering is there any exception that model has non-stationary hours?

Best

In usual models the type of preferences selected assures that hours are stationary by construction. But you could easily prevent this by e.g. using separable preferences between labor and consumption with a risk aversion different than 0. We know from King/Plosser/Rebelo that this type of additive non-log utility is not consistent with a BGP. If there is a unit root in technology (permanent shocks), hours would permanently react to the technology shock (which would most probably be inconsistent with the data).

Thanks alot. I am trying to obtain nonstationary hours data from simulated model that I build now. I use technology shock(random walk with drift) and labor supply shock(according to random walk) with separable utility function following Chang, Doh and Schorfheide (2006). I obtained stationary equilibrium of variables H=H/B(supply shock), Y=Y/A*B(both shocks) etc…After I had the stationary equilibrium, I am trying to calculate the steady states values. I am kind of sure my model is correct but there is something wrong with steady states. I do not know where I should start to properly calculate steady states values for this model(I guess my problem comes from there) Also, should I define the shocks in initval as A=0, B=0? I would really appreciate if you could give me some suggestions about it.

Residuals of the static equations:

Equation number 1 : NaN
Equation number 2 : NaN
Equation number 3 : 0
Equation number 4 : NaN
Equation number 5 : NaN
Equation number 6 : NaN
Equation number 7 : NaN
Equation number 8 : 0
Equation number 9 : NaN
Equation number 10 : NaN
Equation number 11 : NaN
Equation number 12 : NaN
Equation number 13 : NaN
Equation number 14 : NaN
Equation number 15 : NaN
Equation number 16 : NaN
Equation number 17 : NaN
Equation number 18 : NaN
Equation number 19 : NaN

Warning: Some of the parameters have no value (gamma, Ibar, Ybar, Cbar, Wbar, Hbar, Kbar, YHbar)
when using steady. If these parameters are not initialized in a steadystate file, Dynare may not
be able to solve the model…

In test_for_deep_parameters_calibration at 46
In chapter at 235
In dynare at 180

STEADY: The Jacobian contains Inf or NaN. The problem arises from:

STEADY: Derivative of Equation 4 with respect to Variable c (initial value of c: NaN)
STEADY: Derivative of Equation 7 with respect to Variable c (initial value of c: NaN)
STEADY: Derivative of Equation 9 with respect to Variable c (initial value of c: NaN)
STEADY: Derivative of Equation 15 with respect to Variable c (initial value of c: NaN)
STEADY: Derivative of Equation 1 with respect to Variable k (initial value of k: NaN)
STEADY: Derivative of Equation 5 with respect to Variable k (initial value of k: NaN)
STEADY: Derivative of Equation 18 with respect to Variable k (initial value of k: NaN)
STEADY: Derivative of Equation 5 with respect to Variable y (initial value of y: NaN)
STEADY: Derivative of Equation 6 with respect to Variable y (initial value of y: NaN)
STEADY: Derivative of Equation 10 with respect to Variable y (initial value of y: NaN)
STEADY: Derivative of Equation 14 with respect to Variable y (initial value of y: NaN)
STEADY: Derivative of Equation 4 with respect to Variable B (initial value of B: 0)
STEADY: Derivative of Equation 6 with respect to Variable B (initial value of B: 0)
STEADY: Derivative of Equation 1 with respect to Variable h (initial value of h: NaN)
STEADY: Derivative of Equation 4 with respect to Variable h (initial value of h: NaN)
STEADY: Derivative of Equation 6 with respect to Variable h (initial value of h: NaN)
STEADY: Derivative of Equation 9 with respect to Variable h (initial value of h: NaN)
STEADY: Derivative of Equation 10 with respect to Variable h (initial value of h: NaN)
STEADY: Derivative of Equation 17 with respect to Variable h (initial value of h: NaN)
STEADY: Derivative of Equation 19 with respect to Variable y_h (initial value of y_h: NaN)
STEADY: Derivative of Equation 13 with respect to Variable i (initial value of i: NaN)
STEADY: Derivative of Equation 9 with respect to Variable w (initial value of w: NaN)
STEADY: Derivative of Equation 16 with respect to Variable w (initial value of w: NaN)

STEADY: The problem most often occurs, because a variable with
STEADY: exponent smaller than 1 has been initialized to 0. Taking the derivative
STEADY: and evaluating it at the steady state then results in a division by 0.
Error using dynare_solve (line 60)
An element of the Jacobian is not finite or NaN

[ys,check] = dynare_solve([M.fname ‘_static’],…

Error in chapter (line 235)

Error in dynare (line 180)
evalin(‘base’,fname) ;

Your parameter definitions do not work. When setting Wbar, you use Ybar, which is only defined later. As Dynare says

[quote]Warning: Some of the parameters have no value (gamma, Ibar, Ybar, Cbar, Wbar, Hbar, Kbar, YHbar)
when using steady. If these parameters are not initialized in a steadystate file, Dynare may not
be able to solve the model… [/quote]

Dear Johannes. Thanks. I know that there are some issues in steady states. However, I do not know where I should start to find correct steady states to make my model run after I stationarized it. This is my big problem at the moment. I also wanted to add my model’s solution in pdf file here but it exceeds the maximum allowed size. Is there any chance that I can send it to you?

Also, Initial value of the technology shock is 0 (A=0). Is it the same for labor supply shock?( I mean B=0). I think that it is wrong and is going to give me another error. I would really appreciate if you could provide me some suggestions.

Best,
chapter.mod (1.59 KB)

You need to sit down with pencil and paper and get the recursive parameter definitions right. Currently, Cbar is undefined in

```Hbar= (Cbar^(-1)*Wbar)^psi; ```
Note that you can use F9 in Matlab to sequentially execute the parameter definitions. Then this error code will show up.

If you don’t get the parameter definition right, you won’t be able to make your model run. An additional problem is that with the unit root, you won’t be able to numerically compute the steady state, because B is not endogenously determined. You need to use a steady_state file or a steady_state_model-block.

A and B having steady state 0 looks correct, but the way you introduced those shocks looks wrong. Shouldn’t multiplicative shocks like AB end up being additive in logs: A_barexp(ln_A)B_barexp(ln_B)=A_barB_barexp(ln_A+ln_B)?

Dear Johannes. Thanks again. I stationarized the model and it looks correct to me. I think that I am still confused about the shock process and writing them into the dynare.

Shouldn’t multiplicative shocks like AB end up being additive in logs: A_barexp(ln_A)+B_barexp(ln_B)=A_barB_bar*exp(ln_A+ln_B) . This part that you mentioned to me is not clear that much because I wrote them in a different way in dynare . I just posted production function and shock processes in pdf file and shows that how I solve it. I would be very appreciate if you just have a look at attached file. I worked before AG type of shock. I thought I can follow the same process for this shock as well but I see that AG code is stationarized, as there are no permanent shock in levels. In this model, A and B are non-stationary in level. I think that this model has to have a stationary deterministic steady state.

In addition, after I stationarize the model, I just solve the steady states values. but I see in the paper that I am following now, after they stationarize the model, they did log-linearized the model, then they find staady state. I think that my way is also correct since dynare will linearize it automaticly?
Best

Note that I had a typo above I corrected. As in your pdf, I have

But this is not what your mod-file doesn. There it is

That was all I was saying.

Dear Johannes, sorry. I should have posted an updated version of the mod file. I finally managed the steady states values and I think that I have written shocks to the dynare correctly this time. I have another question and issue:

1. In the paper that I am following, After they stationarize the model, they say : With these transformations, we obtain a system of rational expectations equations that characterizes
the equilibrium dynamics of the endogenous variables in the neighborhood of the steady state. It can be solved by standard log-linearization methods, e.g., King, Plosser, and Rebelo (1988), or Sims (2002)… I did not linearize my model but I want Dynare to log linearize it (Thats why I used exp()). I read it one of posts here if I remember it correctly. Is it correct way? and should I apply it to all variables?

2. After I run my model, I have this problem:

Residuals of the static equations:

Equation number 1 : 0
Equation number 2 : NaN
Equation number 3 : NaN
Equation number 4 : 0
Equation number 5 : 1.1612
Equation number 6 : 0
Equation number 7 : -1.854
Equation number 8 : 0
Equation number 9 : 0
Equation number 10 : 0
Equation number 11 : 0
Equation number 12 : 0
Equation number 13 : 0
Equation number 14 : 0
Equation number 15 : 0
Equation number 16 : 0
Equation number 17 : 0

STEADY: The Jacobian contains Inf or NaN. The problem arises from:

STEADY: Derivative of Equation 5 with respect to Variable B (initial value of B: 0)
STEADY: Derivative of Equation 5 with respect to Variable h (initial value of h: 0.418417)

STEADY: The problem most often occurs, because a variable with
STEADY: exponent smaller than 1 has been initialized to 0. Taking the derivative
STEADY: and evaluating it at the steady state then results in a division by 0.
Error using dynare_solve (line 60)
An element of the Jacobian is not finite or NaN

[ys,check] = dynare_solve([M.fname ‘_static’],…

Error in chapter (line 235)

Error in dynare (line 180)
evalin(‘base’,fname) ;

I have had a look at the forum. I understand what it says but I really do not how to solve this issue? I would really appreciate if you could give me some suggestions.

Thanks.
chapter.mod (1.66 KB)

1.) Yes, that is correct
2.) Your model has a unit root by design, Therefore you need to provide a steady_state_model-block. The current error message comes from the fact that you provide an initial value of 0 for A and B, but you use the logarithm of A and B.

Dear Johannes, thank you very much. I used steady state model block following fs2000.mod file. However, I still have issue to compute steady states. I think that I stationarized the model correctly and calculate steady states equations but there is still a problem in equation 7 in model, which I could not figure out the reason. It might be related to shocks. They have unit root process. I declared them, not in levels but in logs (thats why A=1 and B=1 in steady state model block). I think i did it in correct way.
logA(t)=logA(t-1) + epsa(t)
logB(t)=logB(t-1) + epsb(t)

Residuals of the static equations:

Equation number 1 : 0
Equation number 2 : 0
Equation number 3 : 0
Equation number 4 : 0
Equation number 5 : 0
Equation number 6 : 0
Equation number 7 : -0.82291
Equation number 8 : 0
Equation number 9 : 0
Equation number 10 : 0

Error using print_info (line 72)

Error in resid (line 112)
print_info(info,options_.noprint, options_)

Error in chapter (line 137)
resid(1);

Error in dynare (line 180)
evalin(‘base’,fname) ;

Could you please have a look at my codes and give some suggestions?

Best
chapter.mod (1.33 KB)

Your exponent for the steady state of h is wrong. It should be

```h= (alpha*1/c_y)^(psi/(1+psi)); ```

Dear Johannes,thank you. I hope that this is going to be my last question in this post. I was wondering whether this model generates a non-stationary hours or not since both shocks have unit root. Should I need to add back shocks to the model? or I can use as it is.
Best

As your model is in detrended form and the unit root processes A and B do not enter the model anywhere, all model variables are stationary. The same of course will not hold with the non-detrended variables (see e.g. github.com/JohannesPfeifer/DSGE_mod/blob/master/Aguiar_Gopinath_2007/Aguiar_Gopinath_2007.mod). You might want to consider those.

Dear Johannes, thank you. I worked before AG type model which has a trend growth shock. I applied the same process for this but I got an error in below. I think it is related to how I declare them.

Starting MATLAB/Octave computing.

Error: File: chapter.m Line: 156 Column: 29
The expression to the left of the equals sign is not a valid target for an assignment.

Error in dynare (line 180)
evalin(‘base’,fname) ;

Here is what I did:
// Rebuild non-stationary time series by remultiplying with A_{t} and B_{t}

log_A_0=0; //Initialize Level of Technology at t=0;
log_B_0=0; //Initialize Level of Technology at t=0;
log_A(1,1)=log_A_0; //Level of Tech. after shock in period 1
log_B(1,1)=log_B_0; //Level of Tech. after shock in period 1

// reaccumulate the non-stationary level series

for ii=1:options_.periods
Column 156: log_A(ii+1,1)+ log_B(ii+1,1)=log_A(ii,1)+log_B(ii,1);
y_nonstationary(ii+1,1) = y(ii,1)+log_A(ii,1)+log_B(ii,1);
h_nonstationary(ii+1,1) = h(ii,1)+log_B(ii,1);
c_nonstationary(ii+1,1) = c(ii,1)+log_A(ii,1)+log_B(ii,1);
w_nonstationary(ii+1,1) = w(ii,1)+log_A(ii,1)+log_B(ii,1);
y_h_nonstationary(ii+1,1) = y_h(ii,1)+log_A(ii,1)+log_B(ii,1);
i_nonstationary(ii+1,1) = i(ii,1)+log_A(ii,1)+log_B(ii,1);
end

I would really appreciate if you could provide some suggestions.
Best

``is not valid Matlab code. In the left you can only have one variable, not a sum.``

is not valid Matlab code. In the left you can only have one variable, not a sum.

Dear Jonannes. Thanks. It works now. I think that I did it in correct way. In steady state model block A=1 and B=1. So, I thought that log_A_0=1 and log_B_0=1 should equal to 1, not 0.

// Rebuild non-stationary time series by remultiplying with A_{t} and B_{t}

log_A_0=1; //Initialize Level of Technology at t=0;
log_B_0=1; //Initialize Level of Technology at t=0;
log_A(1,1)=log_A_0; //Level of Tech. after shock in period 1
log_B(1,1)=log_B_0; //Level of Tech. after shock in period 1

// reaccumulate the non-stationary level series

for ii=1:options_.periods
log_A(ii+1,1)=log_A(ii,1);
log_B(ii+1,1)=log_B(ii,1);
y_nonstationary(ii+1,1)=y(ii,1)+log_A(ii,1)+log_B(ii,1);
h_nonstationary(ii+1,1)=h(ii,1)+log_B(ii,1);
c_nonstationary(ii+1,1)=c(ii,1)+log_A(ii,1)+log_B(ii,1);
w_nonstationary(ii+1,1)=w(ii,1)+log_A(ii,1)+log_B(ii,1);
y_h_nonstationary(ii+1,1)=y_h(ii,1)+log_A(ii,1)+log_B(ii,1);

end

Could you please have a look and tell me if I miss anything?

Best,

I am a bit lost. If A=1 then log_A=0. But the starting point should be meaningless for the dynamics as the IRFs should be in deviations from this point. What I don’t see in your code is where you update log_A on the basis of its IRF, i.e. the response to the shock.

Dear Johannes, thank you. I checked my stationarized model again and noticed that I missed to put shocks in some equations. I do not really know how to fix what you are saying. Could you please give me an idea how to correct that?
Best,

You are relying on the wrong objects. The variables you use like log_A or y are simulated series, not the IRFs. The IRFs would be e.g. log_A_eps_a and y_eps_a.