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.

Re: hours

Postby jpfeifer » Mon Sep 05, 2016 7:22 am

Code: Select all
 log_A(ii+1,1)+ log_B(ii+1,1)=log_A(ii,1)+log_B(ii,1);

is not valid Matlab code. In the left you can only have one variable, not a sum.
------------
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 » Mon Sep 05, 2016 10:34 am

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

Re: hours

Postby jpfeifer » Tue Sep 06, 2016 10:43 pm

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.
------------
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 Sep 09, 2016 9:20 pm

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,
Last edited by econphd on Tue Oct 04, 2016 6:47 pm, edited 1 time in total.
econphd
 
Posts: 31
Joined: Fri Mar 25, 2016 2:39 pm

Re: hours

Postby jpfeifer » Tue Sep 13, 2016 9:14 am

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.
------------
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 Oct 04, 2016 12:04 pm

Dear Johannes,

Sorry, I am afraid I could not understand your last answer. As I mention before, I am trying to get nonstationary hours and productivity data from this model. Then, I will estimate this simulated data using SVAR. Could you please explain your last answer slightly more and what I need to do? The other thing is that this model gives me negative values for these variables (h_nonstationary, y_h_nonstationary) but I need positive values since I will log the data when I estimate it in SVAR. So, I feel that I made a mistake somewhere or missing somethings? I would really appreciate if you have any suggestions.

Best
Attachments
chapter.mod
(2.05 KiB) Downloaded 84 times
econphd
 
Posts: 31
Joined: Fri Mar 25, 2016 2:39 pm

Re: hours

Postby jpfeifer » Tue Oct 04, 2016 8:38 pm

Sorry, I was thinking about IRFS, not simulations. I guess you are looking for something like
Code: Select all
var c k y B h A y_h i w r g_A g_B;
varexo eps_a eps_b;

parameters delta psi alpha beta ;

% Parameter Values

beta = 0.95;       
psi = 0.33;         
alpha = 0.68;         
delta = 0.05;





Model;   

y = k(-1)^(1-alpha)*exp(eps_a+eps_b)^(alpha-1)*h^alpha;           
g_A=eps_a;
g_B=eps_b;
log(A)=log(A(-1)) + eps_a;                                                                     
log(B)=log(B(-1)) + eps_b;                                                                     
r = (1-alpha)*(y/k(-1))*exp(eps_a+eps_b);   
w= alpha*y/h;                                           
c^(-1)= exp(eps_a(+1)*eps_b(+1))^(-1)*beta*c(+1)^(-1)*(1+r(+1)-delta);   
h^(1/psi)*B^(-1) = c^(-1)*w;                                             
y_h = y/h;                                                         
c + k = y + (1-delta)*k(-1)*exp(eps_a+eps_b)^(-1);             
i = y-c;


end;

steady_state_model;
A=1;
B=1;
r=(1/beta)-(1-delta);
y_k=r/(1-alpha);
k_y=(1-alpha)/r;
i_y=(1/y_k)*delta;
c_y=1-i_y;
h= (alpha*1/c_y)^(psi/(1+psi));
k=((h^alpha)/y_k)^(1/alpha);
y=k^(1-alpha)*h^alpha;
c=c_y*y;
i=i_y*y;
w=alpha*(y/h);
y_h =y/h;
end;

shocks;
var eps_a; stderr 1;
var eps_b; stderr 1;
end;
resid(1);
steady;
check;


stoch_simul(order=1,periods=1000,drop=960) y h c w y_h i g_A g_B;


// 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
    log_A(ii+1,1)=log_A(ii,1)+g_A(ii,1);
    log_B(ii+1,1)=log_B(ii,1)+g_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
------------
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 Oct 05, 2016 8:29 pm

Dear Johannes, yes. this is what I look for but this model still gives me negative values. When I try to estimate this data in SVAR, it gives me this error in below:

Error using bquah (line 65)
Problem with identifying assumptions

So, I thought this error is because of the negative values.
1. Do you think I made a mistake when I stationarized the model or the problem comes from another thing?
In addition, I do not know the reason but drop function does not work in my model. Is there any way to fix that?
Best
econphd
 
Posts: 31
Joined: Fri Mar 25, 2016 2:39 pm

Re: hours

Postby jpfeifer » Thu Oct 06, 2016 6:16 am

You need to provide more detailed information. What do you mean with "negative values" and what does it mean when you write
Error using bquah (line 65)
Problem with identifying assumptions

As this is not a Dynare function I am not familiar with what you are doing.
------------
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 Oct 06, 2016 9:08 am

Dear Johannes,
Regarding the negatives values, the simulated data has negatives values that I obtained from my model in Dynare such as, y_h_nonstationary and h_nonstationary..
-4.97906650373955
-4.17515167608243
-5.79239232538625
-5.29103086176507
-7.04016453180724
-5.39007616179570
-4.04444902163077
-6.79548020288710
-6.55033359569942
-8.33860835239468
........

I thought that this simulated data does not work in Matlab since it has negatives values and it gives me that error in below:

Error using bquah (line 65)
Problem with identifying assumptions

I mean I have a SVAR model using long run restrictions in Matlab. I am running my simulated data in this model and receiving this error in above. in this SVAR model, I need to log the data but I think I cannot log the data which includes negatives values. so, it gave me this error.

I am trying to figure out the problem now. I hope you can give me some suggestions.
Best
econphd
 
Posts: 31
Joined: Fri Mar 25, 2016 2:39 pm

Re: hours

Postby jpfeifer » Fri Oct 07, 2016 3:56 pm

1. If you want log data, then you should model and simulate log data.
2. With linear approximations, you cannot prevent negative values. But you can make them a lot less likely. You currently have a shock process with a huge standard deviation. No wonder you go over any bound.
3. I don't know which problem arises with your identifying assumption.
------------
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 Nov 01, 2016 5:57 pm

Dear Johannes,

1. You meant I need to work with log linearize model. I did not linearize my model but I want Dynare to log linearize it (Thats why I used exp()). In the paper that I am following, they did: "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 thought this is the same what I did.

2. stoch_simul(order=1,periods=1000,drop=960)--- Drop function does not work in dynare. Am I missing something? (I only need 40 years simulated data to estimate it in SVAR. Then, obtain IRFs.)

I would really appreciate if you give me some suggestions.
Best
econphd
 
Posts: 31
Joined: Fri Mar 25, 2016 2:39 pm

Re: hours

Postby jpfeifer » Wed Nov 02, 2016 8:49 am

1. But you did not use the exp() for most of the variables like y.
2. The drop option works exactly as "advertised" in the manual:
Number of points (burnin) dropped at the beginning of simulation before computing
the summary statistics. Note that this option does not affect the simulated series
stored in oo .endo simul and the workspace. Here, no periods are dropped.
------------
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 Nov 04, 2016 6:24 pm

Dear Johannes,

Thanks for that. I can use exp(). However, I also read in guideline in below:

Remark 17 (Dynare’s loglinear option)
While Dynare by default only computes linearizations, it also has the option loglinear
in order to perform log-linearizations at order=1. When using this option, all displayed
results will be for the logged variables, not the original ones.

So, this is a standard log linearization methods. However, after I used this function (loglinear) in my model, the Dynare gave me this errow in below:

You are attempting to simulate/estimate a loglinear approximation of a model, but
the steady state level of the following variables is not strictly positive:
- g_A (00)
- g_B (00)
Undefined function or variable 'isestimation'.

Error in resol (line 121)
if isestimation()

Error in stoch_simul (line 88)
[oo_.dr,info,M_,options_,oo_] = resol(0,M_,options_,oo_);

Error in modfile (line 161)
info = stoch_simul(var_list_);

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

My question is that I can only use this option when I estimate the model? or if it is okay using it if I simulate the model? If yes for the later one, I would really appreciate if you could give me some suggestion to correct it.

Best
Attachments
modfile.mod
(2.1 KiB) Downloaded 47 times
econphd
 
Posts: 31
Joined: Fri Mar 25, 2016 2:39 pm

Re: hours

Postby jpfeifer » Sat Nov 05, 2016 8:45 am

No, you can use that option also for simulation, but it will log ALL variables. Thus, you must not have any variable with 0 or negative steady state. Assuring that can be cumbersome. See the examples at https://github.com/DynareTeam/dynare/tree/master/tests/loglinear
------------
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

Previous

Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 7 guests