var y y1 y2 c i1 i2 g ce1 ce2 n1 n2 rk1 rk2 r q1 q2 k1 k2 x a1 a2 h1 h2 pi rn i k ca ;
varexo e_rn e_g e_a1 e_a2;
parameters beta eta1 eta2 alph delt omeg G_Y C_Y I1_Y I2_Y Ce1_Y Ce2_Y Y1_N1 Y2_N2 X rho_a
Rk1 rho_g Rk2 psi1 psi2 K1_N1 K2_N2 R gam mu nu1 nu2 thet rho_r rho z rho_p;
C_Y = 0.365317843 ; // C/Y
Ce1_Y = 0.038140221 ; //%经普年鉴 （管理费用+营业费用-税金）/GDP
Ce2_Y = 0.012772553 ; //Ce2/Y
I1_Y = 0.200656987 ; //% I1/Y,I1为国有、联营加集体，2005-2007年
I2_Y = 0.290649465 ; //% I2/Y
G_Y = 0.136845775 ; //% G/Y
K1_N1 = 0.981103747 ; //%K1/N1,2009年鉴 规模以上工业企业 平均固定资产净值/所有者权益
K2_N2 = 1.041926716 ; //%K2/N2
Y1_N1 = 0.117117457 ; //%Y/N,
Y2_N2 = 0.251185726 ; //%Y/N,
Y1_Y = 0.521926331;
Y2_Y = 0.478073668;
X = 1.1 ; //%X
beta = 0.96;
R = 1/beta;
alph = 0.35; //capital share of production
eta1 = 2;
eta2 = 3;
omeg = 0.9846;
delt = 0.01;
rho_a = 0.65;
rho_g = 0.61;
psi1 = 0.25;
psi2 = 0.1;
Rk1 = R + 0.195967947;
Rk2 = R +0.156805044;
gam = 0.9;
mu = 0.12;
thet = 0.75;
rho_r = 0.91;
kap = ((1-thet)/thet)*(1-thet*beta);
eps1 = (1-delt)/((1-delt) + ((alph/X)*(Y1_N1/K1_N1)));
eps2 = (1-delt)/((1-delt) + ((alph/X)*(Y2_N2/K2_N2)));
nu1 = 0.1 ;
nu2 = 0.2;
rho =0.9;
rho_p=0.6;
z=0.71332761;//资产之比
model(linear);
y = C_Y*c + I1_Y*i1 + I2_Y*i2+G_Y*g + Ce1_Y*ce1+Ce2_Y*ce2;//4.14
c(+1)*beta = (Rk1*rk1-Rk2*rk2)+beta*c; //4.15
ce1 = n1;//4.14
ce2= n2;//4.14
rk1(+1) - r = -nu1*(n1 -(q1 + k1));
rk2(+1) - r = -nu2*(n2 -(q2 + k2));
rk1*Rk1*K1_N1 = z*alph*(Y1_N1)*(0.52)^(rho-1)*((rho-1)*(y1-y)+y1 - k1(-1) - x)+ K1_N1*(1-delt)*q1 -Rk1*K1_N1*q1(-1);
rk2*Rk2*K2_N2 = (1-z)*alph*(Y2_N2)*0.48^(rho-1)*((rho-1)*(y2-y)+y2 - k2(-1) - x) + K2_N2*(1-delt)*q2 -Rk2*K2_N2*q2(-1);
q1= psi1*(i1 - k1(-1));//4.19 q1(+1) = psi1*(i1(+1)-k1)
q2= psi2*(i2(+1) - k2);
y1 = a1 + alph*k1(-1) + (1-alph)*omeg*h1;//4.20
y2 = a2 + alph*k2(-1) + (1-alph)*omeg*h2;
eta1*(y1 - h1 - x - c) = h1; //4.21
eta2*(y2 - h2 - x - c) = h2;
y=z^(rho)*(y1)+(1-z)^(rho)*y2;
pi*thet = (1-thet)*(1-thet*beta)*(-x) + thet*beta*pi(+1);
k1 = delt*i1 + (1-delt)*k1(-1);
k2 = delt*i2 + (1-delt)*k2(-1);
n1 = gam*R*K1_N1*(rk1 - r(-1)) + r(-1) + n1(-1);
n2 = gam*R*K2_N2*(rk2 - r(-1)) + r(-1) + n2(-1);
rn = rho_r*rn(-1) + rho_p*pi(-1) + e_rn; //4.25
g = rho_g*g(-1) +e_g; //4.26
a1 = rho_a*a1(-1) +e_a1;
a2=rho_a*a2(-1)+e_a2;//4.27
rn = r + pi(+1);
i*I1_Y*I2_Y=(I2_Y+I1_Y*I2_Y)*i1 +(I1_Y+I2_Y*I1_Y)*i2;
k=k1+k2;
ca*(C_Y+Ce1_Y+Ce2_Y)=C_Y*c+Ce1_Y*ce1+Ce2_Y*ce2;
end;
shocks;
var e_rn; stderr 0.001;
var e_g; stderr 0.001;
var e_a1; stderr 0.001;
var e_a2; stderr 0.001;
end;
steady;
check;
//stoch_simul(irf=20) y c r;
varobs y g i pi;
estimated_params;
beta,0.99, , ,beta_pdf,0.99,0.02;
eta1,2, , ,gamma_pdf,2,0.5;
eta2,3, , ,gamma_pdf,3,0.5;
alph,0.35, , ,beta_pdf,0.35,0.02;
omeg,0.9, , ,gamma_pdf,0.9,0.05;
psi1,0.25, , ,gamma_pdf,0.25,0.001;
psi2,0.1, , ,gamma_pdf,0.1,0.001;
gam,0.9, , ,gamma_pdf,0.9,0.005;
nu1,0.03, , ,beta_pdf,0.03,0.1;
nu2,0.05, , ,beta_pdf,0.05,0.1;
thet,0.75, , ,beta_pdf,0.75,0.1;
//Rk1,1.21, , ,normal_pdf,1.21,0.1;
//Rk2,1.17, , ,normal_pdf,1.17,0.1;
z,0.7, , ,normal_pdf,0.7,0.05;
rho,0.9, , ,gamma_pdf,0.9,0.1;
rho_a,0.65, , ,beta_pdf,0.65,0.05;
rho_g,0.61, , ,beta_pdf,0.61,0.05;
rho_r,0.91, , ,beta_pdf,0.91,0.05;
rho_p,0.6,,,beta_pdf,0.6,0.05;
//sig_a,inv_gamma_pdf,0.01,inf; not used in model
//sig_g,inv_gamma_pdf,0.01,inf; not used in model
stderr e_rn,0.01, , ,inv_gamma_pdf,0.01,inf;
stderr e_g,0.01, , ,inv_gamma_pdf,0.01,inf;
stderr e_a1,0.01, , ,inv_gamma_pdf,0.01,inf;
stderr e_a2,0.01, , ,inv_gamma_pdf,0.01,inf;
end;
options_.plot_priors=0;
estimation(datafile=try1,mh_replic=20000,mh_nblocks=4,mh_drop=0.45,mh_jscale=0.4,bayesian_irf,irf=20,mode_compute =6,moments_varendo)y ca i pi;