problem with estimation_params
Posted: Wed Oct 05, 2016 10:23 am
Hi,
I'm running a simple RBC model with monopolistic competition and Stone-Geary preferences and try to estimate parameter b (subsistence consumption) using US data for consumption. Here is the code
%preliminary data
cons = xlsread ('consumption', 1, 'A1:A154');
nobs = 154;
cr = ones(nobs,1);
tr = (1:nobs)';
for i=1:nobs
tr2(i) = tr(i)^2;
end;
log_cons=log(cons)
const = FOLS(log_cons,[cr tr tr2']);
c = log_cons-const.beta(2)*tr-const.beta(3)*tr2'; % eliminate quadratic trend
save rawdata_US_1977Q1_2016q3 c;
var c, k, L, A, Y ;
varexo zz ;
parameters alpha, beta, delta, teta, phi, vi, b, niz, n ;
alpha = 0.333; %capital share to match labor share of 2/3 in US KR, 1999 is 0.333;
teta = 6; %elasticity of substitution for goods
phi = 2; %Frisch elasticity, in KR and BGM 4, in villaverde-ramirez 0.85
beta = 0.99; %in KR 0.984
delta = 0.025;
niz = 0.979;
b = 1.19;
vi = 8.15;
n = 2.015;
model;
k=(1-delta)*k(-1)+exp(A)*k(-1)^alpha*L^(1-alpha)-n*c;
% L=(((1-alpha)*exp(A)*k(-1)^alpha)/((c-b)*vi))^(phi/(1+alpha*phi)); %perf comp
L=(((1-alpha)*exp(A)*(k(-1)^alpha))*((teta-1)*c-b*teta)/((c-b)^2*vi))^(phi/(1+alpha*phi)); %mon comp
%(c-b)^(-1)=beta*(1+alpha*exp(A(+1))*k^(alpha-1)*L(+1)^(1-alpha)-delta)*((c(+1)-b)^(-1)); %perf comp
((teta-1)*c-b*teta)*(c-b)^(-2)=beta*(1+alpha*exp(A(+1))*k^(alpha-1)*L(+1)^(1-alpha)-delta)*(((teta-1)*c(+1)-b*teta)*(c(+1)-b)^(-2)); %mon comp
A=niz*A(-1)+zz;
Y=exp(A)*L^(1-alpha)*k^alpha;
end;
initval;
c = 2.1914529;
L = 0.0608807939;
k = 91.041666655;
A = 0;
Y = 0.0608;
end;
shocks;
var zz = 0.0072^2;
end;
estimated_params ;
b, normal_pdf, 1.19, 0.375;
end;
varobs c;
%estimated_params_init(use_calibration);
%end;
estimation(datafile=rawdata_US_1977Q1_2016q3, first_obs=1,nobs=70,mode_compute=5,mode_check,mh_replic=10000,mh_nblocks=2,mh_jscale=0.65,mh_init_scale=0.5,bayesian_irf,moments_varendo) c ;
%estimated_params_init(use_calibration);
%end;
The following error appears:
Error using schur
First input must be square.
I have tried other options for computing the mode. When I run the same code on an earlier version of dynare, it works!
many thanks for any help
I'm running a simple RBC model with monopolistic competition and Stone-Geary preferences and try to estimate parameter b (subsistence consumption) using US data for consumption. Here is the code
%preliminary data
cons = xlsread ('consumption', 1, 'A1:A154');
nobs = 154;
cr = ones(nobs,1);
tr = (1:nobs)';
for i=1:nobs
tr2(i) = tr(i)^2;
end;
log_cons=log(cons)
const = FOLS(log_cons,[cr tr tr2']);
c = log_cons-const.beta(2)*tr-const.beta(3)*tr2'; % eliminate quadratic trend
save rawdata_US_1977Q1_2016q3 c;
var c, k, L, A, Y ;
varexo zz ;
parameters alpha, beta, delta, teta, phi, vi, b, niz, n ;
alpha = 0.333; %capital share to match labor share of 2/3 in US KR, 1999 is 0.333;
teta = 6; %elasticity of substitution for goods
phi = 2; %Frisch elasticity, in KR and BGM 4, in villaverde-ramirez 0.85
beta = 0.99; %in KR 0.984
delta = 0.025;
niz = 0.979;
b = 1.19;
vi = 8.15;
n = 2.015;
model;
k=(1-delta)*k(-1)+exp(A)*k(-1)^alpha*L^(1-alpha)-n*c;
% L=(((1-alpha)*exp(A)*k(-1)^alpha)/((c-b)*vi))^(phi/(1+alpha*phi)); %perf comp
L=(((1-alpha)*exp(A)*(k(-1)^alpha))*((teta-1)*c-b*teta)/((c-b)^2*vi))^(phi/(1+alpha*phi)); %mon comp
%(c-b)^(-1)=beta*(1+alpha*exp(A(+1))*k^(alpha-1)*L(+1)^(1-alpha)-delta)*((c(+1)-b)^(-1)); %perf comp
((teta-1)*c-b*teta)*(c-b)^(-2)=beta*(1+alpha*exp(A(+1))*k^(alpha-1)*L(+1)^(1-alpha)-delta)*(((teta-1)*c(+1)-b*teta)*(c(+1)-b)^(-2)); %mon comp
A=niz*A(-1)+zz;
Y=exp(A)*L^(1-alpha)*k^alpha;
end;
initval;
c = 2.1914529;
L = 0.0608807939;
k = 91.041666655;
A = 0;
Y = 0.0608;
end;
shocks;
var zz = 0.0072^2;
end;
estimated_params ;
b, normal_pdf, 1.19, 0.375;
end;
varobs c;
%estimated_params_init(use_calibration);
%end;
estimation(datafile=rawdata_US_1977Q1_2016q3, first_obs=1,nobs=70,mode_compute=5,mode_check,mh_replic=10000,mh_nblocks=2,mh_jscale=0.65,mh_init_scale=0.5,bayesian_irf,moments_varendo) c ;
%estimated_params_init(use_calibration);
%end;
The following error appears:
Error using schur
First input must be square.
I have tried other options for computing the mode. When I run the same code on an earlier version of dynare, it works!
many thanks for any help