clear all
close all
addpath  D:\MATLAB1\dynare.4.4.3\matlab

beta = 0.9922;
betab=0.9835;
betaf=0.97;
g=0.01;
b = 0.7;
mu_d =1;
theta_d = 0.012;
mu_dc = 1.1;
theta_dc = 0.0132;
phi = 1;
mu_n = 1;
epsp =11;
alpha = 0.45;
kappa = 0.74;
delta = 0.03;
a = 0.03;
xi = 0.006;
tau = 0.005; 
phipi = 1.2;
phiY=0.6;
phi0 = 0.07;
omega = 0.002;
omicron=((betab*(betaf*(1/beta-1)+a)+betaf*(1-a)*(xi-tau)))/(2*betab*(betaf*(1/beta-1)+a)+betaf*(1-a)*(xi-tau)+betab*g*(1-a));

rhoa = 0.89;
rhonu = 0.95;
rhoh = 0.9;
rhodc = 0.8;
sda=0.01;
sdnu = 0.006;
sdh = 0.01;
sddc=0.01;


dps=1;
As=1;
pis =1;
pistars=1;
nus=1;
mus=0;
hs=0.0075;
h1 =0.02;
r_bhs = 1/beta - 1;
r_zs=(a+betaf*r_bhs)/((1-a)*betaf);
r_ns = (betaf*r_zs+g)/betaf;
r_ss = r_zs-tau/betab;
r_ls = r_ss+xi/betab;
mcs = (epsp-1)/epsp;
ws = (1-alpha)*(mcs*omicron^alpha*alpha^alpha/r_ls^alpha)^(1/(1-alpha));
kn = (ws*omicron*alpha)/(r_ls*(1-alpha));
r_Rs=r_ss-h1;
r_ds=r_Rs+hs;
r_dcs = r_Rs;
Rs=omega/(betab*(r_ss-r_ds));
ds=betab*(r_ss-r_Rs)*Rs^2/omega;

Ns = 1/3;%八小时工作制
Ks = kn*Ns;
Ys = Ks^alpha*Ns^(1-alpha);
lam1s = mu_n*Ns^phi/ws;
cs = (1-beta*b)/((1-b)*lam1s);
x1s = lam1s*mcs*Ys/(1-kappa*beta);
x2s = lam1s*Ys/(1-kappa*beta);


dcs= (((lam1s-lam1s*beta*(1+r_dcs))/mu_dc))^(-1/theta_dc);
lam2s=mu_d*(ds^(-theta_d))-lam1s+beta*(1+r_ds)*lam1s;
Ss = Rs +dcs;


ZGs=(Ys-cs-omega*ds/Rs-(1+xi)*(ds+Ss+Rs)+ws*Ns-(Ks-omicron*(ds+Ss-Rs))*(1+g*(1-a))/((1-omicron)*(1-a)))/((1+g*(1-a))*(2*omicron-1)/((1-omicron)*(1-a))+g-xi+tau);
Lbs=ds+Ss-Rs-ZGs;
L_ns=(Ks-omicron*Lbs)/(1-omicron);
Bhs=(L_ns-ZGs)/(1-a);
invs= Lbs+L_ns-ws*Ns;

%save all the variables into mat file and the load in mod file
save dsge;
%run the dynare mod file or the compiled mod m file
dynare dsge;




