Fix preprocessor bug when model-local variable is specified as an estimated parameter
In the following mod-file djen
is a model-local variables, but specified in the estimated_params
-block. The preprocessor then falsely sets
estim_params_.param_vals = [estim_params_.param_vals; 0, NaN, (-Inf), Inf, 2, 2, 1, NaN, NaN, NaN ];
but the first entry is the position in M_.params
and can never be 0. We should disallow using model-local variables in the parameter blocks.
%Model BSB;
var x i dp y n mc mrs c a g dw;
varexo epsilon_a epsilon_g epsilon_ms epsilon_mu;
parameters sigma thetap thetaw beta phi alpha gammay gammapi rhoi rhoa rhog delta mub gam sigmaa sigmams sigmag sigmamu epsilonstar;
model;
#ms=epsilon_ms;
#mu=epsilon_mu;
0 = -sigma * i + sigma * dp(+1) - sigma * g(+1) + sigma * g - c + c(+1);
0 = -y + a + (1-delta) * n;
0 = y - n + mc - x;
0 = -mrs + c / sigma + gam * n - g;
0 = -i + rhoi * i(-1) + gammapi * (1-rhoi) * dp + gammay * (1-rhoi) * y + ms;
0 = -x + x(-1) + dw - dp;
0 = -y + c;
a(+1) = rhoa * a + epsilon_a(+1);
g(+1) = rhog * g + epsilon_g(+1);
%kappap = (1- delta)*(1-thetap*beta)*(1-thetap) / (thetap*(1+delta*(epsib-1)));
%0 = kappap * mc + kappap * mu - dp + beta * dp(+1);
0 = (1- delta)*(1-thetap*beta)*(1-thetap) / (thetap*(1+delta*(epsilonstar-1))) * mc + (1- delta)*(1-thetap*beta)*(1-thetap) / (thetap*(1+delta*(epsilonstar-1))) * mu - dp + beta * dp(+1);
mrs=x;
#djen=(1/(1-thetap))-1;
%epsib = mub / (mub-1);
end;
varobs i dp dw y;
estimated_params;
stderr epsilon_a, normal_pdf,,, 0, sigmaa;
stderr epsilon_g, normal_pdf,,, 0, sigmag;
stderr epsilon_ms, normal_pdf,,, 0, sigmams;
stderr epsilon_mu, normal_pdf,,, 0, sigmamu;
sigmag, uniform_pdf,,, 0, 1;
sigmamu, uniform_pdf,,, 0, 1;
sigmams, uniform_pdf,,, 0, 1;
sigmaa, uniform_pdf,,, 0, 1;
rhoa, uniform_pdf, 0, 1;
rhog, uniform_pdf, 0, 1;
rhoi, uniform_pdf, 0, 1;
gam, normal_pdf, 1, 0.5;
gammay, normal_pdf, 0.125, 0.125;
gammapi, normal_pdf, 1.5, 0.25;
sigma, inv_gamma_pdf, 2, 1.25;
djen, gamma_pdf, 2, 1;
end;
%steady;
%check;
%epsilon = epsib;
%mu = mub;
%end;
steady_state_model;
epsilonstar = mub/ (mub-1);
end;
%steady;
%check;
estimation(datafile=usdata, mh_jscale=0.5);