Page 1 of 1

Optimal policy and welfare losses

PostPosted: Wed Dec 07, 2011 11:25 am
by Tunit
Hi,
Does anyone know how to write a loop to obtain a number welfare losses for alternative parameter values using the ramsey_policy function.
For example,

rhos=[0.5,0.6,0.8,0.9];
for i =1:length(rhos)
rho=rhos(i);
Stoch_simul;
end

works for a usual file with just simulations yet I get the following error message when trying to obtain the ramsey losses.

??? Index exceeds matrix dimensions.

Error in ==> stoch_simul at 142
var_listTeX = M_.endo_names_tex(i_var,:);
Thanks
Tunit

Re: Optimal policy and welfare losses

PostPosted: Wed Jan 04, 2012 11:19 am
by SébastienVillemot
Can you post your complete MOD file?

Re: Optimal policy and welfare losses

PostPosted: Fri Jan 06, 2012 11:02 am
by Tunit
HI thanks for the reply. Below is the file. essentially what I would like to do is simulate (and save) the welfare losses for a range of one exogenous variable eg rho=[0, 0.1, 0.1...1]/
this is possible for a range of simulated output (using the method outilined in my original post). However, I do not seem to be able to any same result using the ramsey_policy function.
Best,
Tunit
~~~~~~~~~~~~~~~~~~~~
///Simulations

//Endogenous Variables
var
xtilde,
xeuler,
gshock,
pi,
yflex,
ytilde,
int,
a,
xi,
v;



//Exogenous variables
Varexo
epsilona,
epsilonxi,
epsilonv;

//Parameters
parameters
theta,
thetafixed
omega,
beta,
kappa,
sigma,
gamma,
eta,
phipi,
phix,
rhoa,
rhoxi,
rhov,
rhoint,
stdra,
stdrxi,
stdrv,
delta,
vartheta,
lambdapi,
lambdaxi;


beta=0.99; //Discount rate
sigma=1.5;
thetafixed=1.5; //Intertemporal elasticity of substitution in consumption
theta=0; //The price elasticity of demand
omega=0.75; //percentage of firms unable to alter thier price in each period
gamma=1; //Intertemporal elasticity of substituiton in the labour market.
rhoa=0.85; //Persistence of productivity shocks
rhoxi=0.85; //Persistence of taste shocks
rhov=0.5; //Persistence of policy shocks
rhoint=0.85; //persistence of the interest rate
phipi=1.5; //weight on interest rate in objective function
phix=0.5/4; //weight on output gap in objectibe function
eta=0; //percentage of backward looking firms //persistence of interest rate shocks
stdra=0; //variance of technology shocks
stdrxi=0; //variance of taste shocksw
stdrv=0.25; //variance of interest rate shocks
delta=1; //when 1 we have cost channel when zero no channel
vartheta=omega+(eta*(1-omega*(1-beta))); //backward looking element
kappa=(1-omega*beta)*(1-omega)/omega; //slope of the Phillips Curve
lambdapi=(thetafixed/kappa);
lambdaxi=(sigma+gamma);




model;

xtilde=xeuler-((theta/kappa)*pi)+((theta/kappa)*beta*pi(1));//Outputgap

xeuler=xeuler(1)-(1/sigma)*(int-pi(1))+gshock; //Euler equation

gshock=((1+gamma)/(gamma+sigma))*(a(1)-a)-(gamma/(sigma*(gamma+sigma)))*(xi(1)-xi); //disturbance term

pi=((1-omega)*(1-omega*beta)/(omega+(eta*(1-omega))))*(((1-eta)*(((sigma+gamma)*xtilde)+(delta*int)))+(eta*(((sigma+gamma)*xtilde)+(delta*int))))+((((1-omega)*eta)/(omega+(eta*(1-omega))))*pi(-1))+(((omega*beta)/(omega+(eta*(1-omega))))*pi(1));
//Phillips Curve

yflex=(((1+gamma)/(gamma+sigma)))*a+(1/(gamma+sigma))*xi; //flexible Output

ytilde=xtilde+yflex; //Output or Consumption

int=rhoint*int(-1)+(1-rhoint)*((phipi*pi)+(phix*xtilde))+v; ///interest rate

a=rhoa*a(-1)+epsilona; //Ar(1) technology
xi=rhoxi*xi(-1)+epsilonxi; //Ar(1) taste
v=rhov*v(-1)+epsilonv; //Ar(1) int


end;
check;
steady;

shocks;
var epsilona;
stderr stdra;
var epsilonxi;
stderr stdrxi;
var epsilonv;
stderr stdrv;
end;

planner_objective lambdapi*pi^2 + lambdaxi*xi^2;

ramsey_policy;

loss=.5*(lambdapi*oo_.var(4,4)+lambdaxi*oo_.var(1,1));
lossinf=0.5*(lambdapi*oo_.var(4,4));
lossout=0.5*(lambdaxi*oo_.var(1,1));

Re: Optimal policy and welfare losses

PostPosted: Mon Jan 16, 2012 5:15 pm
by SébastienVillemot
I'm afraid that this exercise will be difficult with the current version of Dynare (4.2) for two reasons:

- ramsey_policy seems to not work within a loop
- ramsey_policy does not give the value of the welfare

You may want to try with the unstable snapshot of Dynare (the usual disclaimer applies here), since the ramsey policy engine was rewritten there. But there seem to be also issues to resolve in your model: Dynare unstable complains about the fact that initial values are incompatible with some equations (I did not investigate this issue).

Re: Optimal policy and welfare losses

PostPosted: Tue May 15, 2012 6:39 pm
by YHS
You have to remove "check;" and "steady;" when using Ramsey policy.

Re: Optimal policy and welfare losses

PostPosted: Wed Aug 01, 2012 9:08 am
by mnb_kobercs
Hi all!

Is it possible, to control somehow on impulse response functions, when computing optimal ramsey or osr in dynare?
for example: I (and the mpc) won't belive in an "optimal" policy that suggest rate cuts for a demand shock
many thanks!

Re: Optimal policy and welfare losses

PostPosted: Wed Aug 01, 2012 2:57 pm
by mnb_kobercs
Hi!
Another question.
How can I add bounds, for the osr parameters? I got an optimal solution where the interest rate smoothing higher than 1... :cry:
please help me!!!

Re: Optimal policy and welfare losses

PostPosted: Tue Dec 10, 2013 9:45 am
by Kuralay
Hi, who could explain me what do numbers (4,4) and (1,1) mean in this welfare loss equation?

loss=.5*(lambdapi*oo_.var(4,4)+lambdaxi*oo_.var(1,1));

Thanks in advance.

Re: Optimal policy and welfare losses

PostPosted: Tue Dec 10, 2013 10:00 am
by jpfeifer
Those are entries of the variance covariance matrix. They are the variance of the first and fourth variable, respectively.