http://www.dynare.org/phpBB3/viewtopic.php?f=1&t=2812
I already implemented the osr command in a matlab for loop that varies the parameters but I don't see any changes in the objective function value when the values of the parameters are updated.
This is the .mod file:
- Code: Select all
var ytilde pi i y yn r rn mc n a z rnhat;
varexo ea ez;
parameters cbeta cgamma cnu calpha cepsilon_f comega phipi phiy crhoa crhoz
rrho rMU rmu rTHETA rlambda rupsilonyn rpsiyna rkappa rLAMBDAa;
cbeta = 0.99;
cgamma = 1;
cnu = 1;
calpha = 0;
cepsilon_f = 11;
comega = 3/4;
phipi = 1.5;
phiy = 0.125;
crhoa = 0.9;
crhoz = 0.7;
lambda1 = 0.6;
rrho = (1/cbeta-1);
rMU = cepsilon_f/(cepsilon_f-1);
rmu = log(rMU);
rTHETA = (1-calpha)/(1-calpha+calpha*cepsilon_f);
rlambda = (((1-comega)*(1-cbeta*comega))/comega)*rTHETA;
rupsilonyn = -((1-calpha)*rmu-log(1-calpha))/(cgamma*(1-calpha)+cnu+calpha);
rpsiyna = (1+cnu)/(cgamma*(1-calpha)+cnu+calpha);
rkappa = rlambda*(cgamma+((cnu+calpha)/(1-calpha)));
rLAMBDAa = 1/((1-cbeta*crhoa)*((cgamma*(1-crhoa)+phiy))+rkappa*(phipi-crhoa));
model(linear);
ytilde = rnhat*(1-cbeta*crhoa)*rLAMBDAa;
rnhat = -cgamma*rpsiyna*(1-crhoa)*a;
r = i-pi(+1);
rn = rrho - cgamma*(1-crhoa)*rpsiyna*a+(1-crhoz)*z;
yn = rupsilonyn + rpsiyna*a;
pi = cbeta*pi(+1) + rkappa*ytilde;
mc = (cgamma + ((cnu+calpha)/(1-calpha)))*yn - ((1+cnu)/(1-calpha))*a - log(1-calpha);
i = phipi*pi+phiy*y;
y = ytilde + yn;
n = (1/(1-calpha))*(y - a);
a = crhoa*a(-1) + ea;
z = 0; //crhoz*z(-1) + ez;
end;
check;
steady;
shocks;
var ea = 1^2;
end;
optim_weights;
pi 1;
y lambda1;
end;
osr_params phipi phiy;
osr (order=1,nograph);
and this is a simplified version of the matlab file that only modifies the phipi value:
- Code: Select all
dynare base noclearall;
phiS = [0,1];
for i = 1:length(phiS)
set_param_value('phipi', phiS(i));
osr(var_list_,osr_params_,obj_var_,optim_weights_);
end
The output value that get for the objective function is:
OPTIMAL VALUE OF THE PARAMETERS:
phipi 1.67465e-011
phiy 0.125001
Objective function : 2.73651
for phipi=0 and for phipi=1
OPTIMAL VALUE OF THE PARAMETERS:
phipi 1
phiy 0.125002
Objective function : 2.73651
As you can see, the objective function values doesn't change, however, when I modify directly the parameter values in the .mod file it does change.
What I'am doing wrong?
Thanks in advance.