Unrealized Expectations

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.

Unrealized Expectations

Postby justus » Thu Jul 11, 2013 3:55 pm

Dear forum,

I know that this topic has been discussed in this forum numerous times, however I did not get a satisfying answer.

My goal is to model the anticipation of an innovation in technology 8 periods before it hits the economy. However, when the 8th period comes, this shock is not realized (preferrably, no shock hits the economy; but I am already satisfied when the shock is less than expected if the preferred solution does not work out). For example Levin et al. (2003) have such an unrealized news shock in their paper - however in the model replication available in the macromodel database I could not spot the relevant equations.

Theoretically, I could induce an expectation by the lagged variable ant(-8). By the time the 8th period comes, a surprise shock (exo) sur hits the equation which perfectly (or less than perfectly) outweighs this innovation (of size news). However, in my understanding sur is a random variable to which I cannot assign a certain value (or can I?). If it was not a random variable, it would be anticipated anyway (wouldn't it?) and it would tell a different story.

a = rho*a(-1) + ant(-8) + sur;
ant = news;
sur = -news;

Does anybody have an idea?
Thank you.
justus
 
Posts: 9
Joined: Mon Jun 17, 2013 6:59 pm

Re: Unrealized Expectations

Postby jpfeifer » Thu Jul 11, 2013 4:33 pm

What exactly are you trying to do? Is it only about generating an IRF, i.e. a policy experiment? Because what you describe is not part of the model. Having two exactly offsetting shocks is a 0 probability event to which agents thus assign no probability. Usually, what people do (following Beaudry/Portier (2004) I think) is model a "pure news shock" as hitting the economy with a news shock at time t-8 and then at time t hitting the economy with an additional surprise shock that exactly offsets the news shock so that the underlying exogenous variable stays constant. Is this what you are trying to do?
------------
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: Unrealized Expectations

Postby justus » Thu Jul 11, 2013 4:44 pm

Yes, this is what I meant, sorry for not expressing this idea precisely: The news shock hits the economy in t-8, i.e. agents learn at time t-8 that that there is an increase in TFP in t. This is not realized though because a surprise shock offsets the news shock.

Is it possible to implement this?
justus
 
Posts: 9
Joined: Mon Jun 17, 2013 6:59 pm

Re: Unrealized Expectations

Postby jpfeifer » Thu Jul 11, 2013 9:52 pm

Yes, it is:

Code: Select all
/*
 * This file implements a simple RBC model with TFP news calibrated to US data. It shows how
 * to generate IRFs to a "pure" news shock where an 8 period anticipated news shock does not materialize at time 0.
 * This is the type of policy experiment that is for example performed in Beaudry Portier (2004): An exploration 
 * into Pigou’s theory of cycles, Journal of Monetary Economics 51, pp. 1183–1216.
 *
 * Note that having two exactly offsetting shocks from continuous distributions to keep the exogenous variable constant
 * is a 0 probability event for the agents of the model.
 *
 * This implementation was written by Johannes Pfeifer. In case you spot mistakes,
 * email me at jpfeifer@gmx.de
 *
 * This mod-file uses variable substitution to perform a log-linearization of the model. All variables,
 * except for the interest rate (which is already in percent), are put in exp() for this purpose.
 *
 * Please note that the following copyright notice only applies to this Dynare
 * implementation of the model.

 */

/*
 * Copyright (C) 2013 Dynare Team
 *
 * This file is part of Dynare.
 *
 * Dynare is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Dynare is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
 */


var y c k l z r w invest;
varexo eps_z_news eps_z_surprise;


parameters beta psi sigma delta alpha rhoz gammax
    gshare l_ss k_ss i_ss y_ss g_ss c_ss rhog;

% set parameter values
sigma=1;                % risk aversion
alpha= 0.33;            % capital share
i_y=0.25;               % investment-output ration
k_y=10.4;               % capital-output ratio
x=0.0055;               % technology growth (per capita output growth)
n=0.0027;               % population growth
gammax=(1+n)*(1+x);
delta=i_y/k_y-x-n-n*x;  %deprecation rate
beta=gammax/(alpha/k_y+(1-delta)); %discount factor
rhoz=0.97;              %technology autocorrelation base on linearly detrended Solow residual

% calibrate the model to steady state labor of 0.33, i.e. compute the corresponding steady state values
% and the labor disutility parameter by hand; the steady state values are used later in the initval-block

l_ss=0.33;
k_ss=((1/beta*gammax-(1-delta))/alpha)^(1/(alpha-1))*l_ss;
i_ss=(x+n+delta+n*x)*k_ss;
y_ss=k_ss^alpha*l_ss^(1-alpha);
c_ss=y_ss-i_ss;
psi=(1-alpha)*(k_ss/l_ss)^alpha*(1-l_ss)/c_ss^sigma; %labor disutility parameter that sets labor to 0.33 in steady state


model;
//1. Euler equation
exp(c)^(-sigma)=beta/gammax*exp(c(+1))^(-sigma)* (alpha*exp(z(+1))*(exp(k)/exp(l(+1)))^(alpha-1)+(1-delta));
//2. Labor FOC
psi*exp(c)^sigma*1/(1-exp(l))=exp(w);
//3. Law of motion capital
gammax*exp(k)=(1-delta)*exp(k(-1))+exp(invest);
//4. resource constraint
exp(y)=exp(invest)+exp(c);
//5. production function
exp(y)=exp(z)*exp(k(-1))^alpha*exp(l)^(1-alpha);
//6. real wage/firm FOC labor
exp(w)=(1-alpha)*exp(y)/exp(l);
//7. annualized real interst rate/firm FOC capital
r=4*alpha*exp(y)/exp(k(-1));
//8. exogenous TFP process
z=rhoz*z(-1)+eps_z_surprise + eps_z_news(-8);
end;

%set steady state values computed above
initval;
    invest=log(i_ss);
    w=log((1-alpha)*y_ss/l_ss);
    r=4*alpha*y_ss/k_ss;
    y=log(y_ss);
    k=log(k_ss);
    c=log(c_ss);
    l=log(l_ss);
    z=0;
end;

shocks;
    var eps_z_news=1; //8 period anticipated TFP news shock
    var eps_z_surprise=1; //TFP surprise shock
end;

steady;
check;

stoch_simul(order=1,irf=40);


//************ The following line generate the IRFs to a "pure" TFP news shock, i.e. the anticipated shock is
//************ counteracted by an opposite surprise shock when it is supposed to realize

//initialize IRF generation
temps = repmat(oo_.dr.ys,1,M_.maximum_lag);
shock_matrix = zeros(options_.irf,M_.exo_nbr); %create shock matrix with number of time periods in colums

// set shocks for pure news
shock_matrix(1,strmatch('eps_z_news',M_.exo_names,'exact')) = 1; %set news shock to 1 (use any shock size you want)
shock_matrix(1+8,strmatch('eps_z_surprise',M_.exo_names,'exact')) = -1; %8 periods later use counteracting shock of -1

y2 = simult_(temps,oo_.dr,shock_matrix,1);
y_IRF = y2(:,M_.maximum_lag+1:end)-repmat(oo_.dr.ys,1,options_.irf); %deviation from steady state


// manually select variables for figure
figure
subplot(2,1,1)
plot(y_IRF(strmatch('y',M_.endo_names,'exact'),:)); % use strmatch to select values
title('Output');
subplot(2,1,2)
plot(y_IRF(strmatch('z',M_.endo_names,'exact'),:));
title('TFP');

// Automatically loop over variables for figure (may require different setting for subplots in larger models)
figure
for ii=1:M_.orig_endo_nbr
    subplot(3,3,ii)
    if max(abs(y_IRF(ii,:)))>1e-12 %get rid of numerical inaccuracies
        plot(y_IRF(ii,:));
    else
        plot(zeros(options_.irf,1));
    end
    title(deblank(M_.endo_names(ii,:)));
end

Attachments
RBC_news_shock_model.mod
Mod-file generating "pure" news shock
(5.31 KiB) Downloaded 138 times
------------
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: Unrealized Expectations

Postby justus » Fri Jul 12, 2013 5:43 pm

Thank you, jpfeifer, I very much appreciate that you are sharing this code!!

Please allow me one follow-up question:
This code generates 4 figures where the first two show the impact of one of the two exo. shocks eps_z_news and eps_z_surprise at a time.
The third and fourth figures show the deviations from steady state with the unrealized news shock. However, I do not understand why the output (y) graph in the third figure differs from the y-graph in the fourth. Both should be plotting the same values in the corresponding matrix y_IRF. The same applies for capital.
When I type plot(y_IRF(1,:); it shows the y-graph of the third, not the fourth figure (although this is the code that is used in the for loop).
I hope you get my point.
justus
 
Posts: 9
Joined: Mon Jun 17, 2013 6:59 pm

Re: Unrealized Expectations

Postby jpfeifer » Fri Jul 12, 2013 5:53 pm

Sorry, stupid mistake that I have now corrected above. I check for the max(), but it should have been max(abs()).
------------
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: Unrealized Expectations

Postby justus » Fri Jul 12, 2013 8:30 pm

Well, I could have noticed that myself...
Thank you once again.
justus
 
Posts: 9
Joined: Mon Jun 17, 2013 6:59 pm

Re: Unrealized Expectations

Postby J.Höffler » Sat Aug 02, 2014 4:11 am

If you are interested in replication, this might be of interest to you: viewtopic.php?f=2&t=5926
J.Höffler
 
Posts: 15
Joined: Fri Aug 01, 2014 3:14 pm


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 8 guests

cron