hours

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

hours

Postby econphd » Wed Aug 10, 2016 11:32 am

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
econphd
 
Posts: 31
Joined: Fri Mar 25, 2016 2:39 pm

Re: hours

Postby jpfeifer » Fri Aug 12, 2016 7:04 am

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).
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: hours

Postby econphd » Fri Aug 26, 2016 9:11 pm

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 steady at 33
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

Error in evaluate_steady_state (line 66)
[ys,check] = dynare_solve([M.fname '_static'],...

Error in steady_ (line 54)
[steady_state,params,info] =
evaluate_steady_state(oo_.steady_state,M_,options_,oo_,~options_.steadystate.nocheck);
Error in steady (line 81)
[steady_state,M_.params,info] = steady_(M_,options_,oo_);

Error in chapter (line 235)
steady;

Error in dynare (line 180)
evalin('base',fname) ;
Last edited by econphd on Tue Aug 30, 2016 8:35 pm, edited 1 time in total.
econphd
 
Posts: 31
Joined: Fri Mar 25, 2016 2:39 pm

Re: hours

Postby jpfeifer » Sat Aug 27, 2016 9:16 am

Your parameter definitions do not work. When setting Wbar, you use Ybar, which is only defined later. As Dynare says
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...
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: hours

Postby econphd » Sun Aug 28, 2016 6:57 pm

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,
Attachments
chapter.mod
(1.59 KiB) Downloaded 100 times
econphd
 
Posts: 31
Joined: Fri Mar 25, 2016 2:39 pm

Re: hours

Postby jpfeifer » Mon Aug 29, 2016 6:50 am

You need to sit down with pencil and paper and get the recursive parameter definitions right. Currently, Cbar is undefined in
Code: Select all
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 A*B end up being additive in logs: A_bar*exp(ln_A)*B_bar*exp(ln_B)=A_bar*B_bar*exp(ln_A+ln_B)?
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: hours

Postby econphd » Tue Aug 30, 2016 9:18 pm

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 A*B end up being additive in logs: A_bar*exp(ln_A)+B_bar*exp(ln_B)=A_bar*B_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
Last edited by econphd on Sat Sep 03, 2016 4:16 pm, edited 1 time in total.
econphd
 
Posts: 31
Joined: Fri Mar 25, 2016 2:39 pm

Re: hours

Postby jpfeifer » Wed Aug 31, 2016 7:13 am

Note that I had a typo above I corrected. As in your pdf, I have
Code: Select all
A_tB_t=exp(ln_A+ln_B)

But this is not what your mod-file doesn. There it is
Code: Select all
exp(ln_A*ln_B)

That was all I was saying.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: hours

Postby econphd » Wed Aug 31, 2016 8:50 pm

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

Error in evaluate_steady_state (line 66)
[ys,check] = dynare_solve([M.fname '_static'],...

Error in steady_ (line 54)
[steady_state,params,info] =
evaluate_steady_state(oo_.steady_state,M_,options_,oo_,~options_.steadystate.nocheck);
Error in steady (line 81)
[steady_state,M_.params,info] = steady_(M_,options_,oo_);

Error in chapter (line 235)
steady;

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.
Attachments
chapter.mod
(1.66 KiB) Downloaded 76 times
econphd
 
Posts: 31
Joined: Fri Mar 25, 2016 2:39 pm

Re: hours

Postby jpfeifer » Thu Sep 01, 2016 5:06 am

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.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: hours

Postby econphd » Thu Sep 01, 2016 10:12 pm

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)
The steadystate file did not compute the steady state

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
Attachments
chapter.mod
(1.33 KiB) Downloaded 72 times
econphd
 
Posts: 31
Joined: Fri Mar 25, 2016 2:39 pm

Re: hours

Postby jpfeifer » Sat Sep 03, 2016 9:48 am

Your exponent for the steady state of h is wrong. It should be
Code: Select all
h= (alpha*1/c_y)^(psi/(1+psi));
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: hours

Postby econphd » Sat Sep 03, 2016 8:33 pm

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
econphd
 
Posts: 31
Joined: Fri Mar 25, 2016 2:39 pm

Re: hours

Postby jpfeifer » Sun Sep 04, 2016 3:07 pm

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. https://github.com/JohannesPfeifer/DSGE_mod/blob/master/Aguiar_Gopinath_2007/Aguiar_Gopinath_2007.mod). You might want to consider those.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: hours

Postby econphd » Sun Sep 04, 2016 10:05 pm

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
econphd
 
Posts: 31
Joined: Fri Mar 25, 2016 2:39 pm

Next

Return to Dynare help

Who is online

Users browsing this forum: No registered users and 10 guests