help for estimation

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

help for estimation

Postby d115215315 » Sun Jul 15, 2012 7:38 pm

hello everyone
i try to replicate Paolo Gelain(2010) with Taiwanese data,
but i don't understand what observable data should put in,
should i put measurement equation like SW(2007)?

pls, help!
Code: Select all
//Paolo Gelain_rep
var          R nR pi C I Y Q K w  L rk mc Rek NW E S
             eB ew ep em x g A
             dY dC dI dw pi_obs nR_obs L_obs
             Y_star CF IF QF RekF RF KF wF LF rkF mcF ;                       

//shocks
varexo       uB uw um ux up ug uA ;

//Parameters
parameters   h f sigma_c theta varphi delta beta alpha gamma_w xi_w theta_w sigma_l psi gamma_p xi_p varkappa vartheta_e KNW R_ss S_ss xi_e xi_r xi_y
             xi_deltapi xi_deltay  Rek_ss NWK  xi_pi CY rho_B rho_w rho_m rho_p rho_x rho_g rho_A
             trend rbar pibar lbar;

beta=0.9875;
R_ss=1/beta;
delta=0.025;
S_ss=1.02;
alpha=0.3;
Rek_ss=S_ss*R_ss;
KNW=1.2387;
NWK=1/KNW;
theta_w=4;
theta=4;
CY=0.6;
h=0.934;

sigma_l=5;
sigma_c=0.66;
gamma_w=0.3892;
gamma_p=0.2784;
rho_B=0.8969;
rho_w=0.9707;
rho_m=0.8;
rho_p=0.8;
rho_x=0.6941;
rho_g=0.8685;
rho_A=0.9644;
xi_r=0.9075;
xi_pi=1.6633;
xi_y=0.1054;
xi_w=0.939;
xi_p=0.944;
xi_deltay=0.2061;
xi_deltapi=0.1417;
xi_e=0.7458;
varkappa=0.048;
vartheta_e=0.9728;
varphi=6.5431;
f=0.1657;
psi=0.0294;

lbar=0;
rbar=1.189;
pibar=-0.016;
trend=0.9832;


model(linear);
#aa=alpha^alpha*(1-alpha)^(1-alpha);
#rk_ss=(S_ss/beta)+delta-1;
#mc_ss=(theta-1)/theta;
#w_ss=(aa*mc_ss/(rk_ss^(alpha)))^(1/(1-alpha));
#LK=(1-alpha)/alpha*(rk_ss/w_ss);
#KY_ss=(1+f)*LK^(alpha-1);
#IY=delta*(1+f)*LK^(alpha-1);
#GY=1-IY-CY;
#CK=(1-GY)/(1+f)*LK^(1-alpha)-delta;
#K_ss=(w_ss*(theta_w-1)/theta_w*((1-h)*CK)^(-sigma_c)*LK^(-
sigma_l))^(1/(sigma_l+sigma_c));
#C_ss=CK*K_ss;
#I_ss=delta*K_ss;
#Y_ss=(C_ss+I_ss)/(1-GY);
#L_ss=LK*K_ss;
#KY=K_ss/Y_ss;

#rkF_ss=(1/beta)+delta-1;
#mcF_ss=(theta-1)/theta;
#wF_ss=(aa*mcF_ss/(rkF_ss^(alpha)))^(1/(1-alpha));
#LKF=(1-alpha)/alpha*(rkF_ss/wF_ss);
#KYF_ss=(1+f)*LKF^(alpha-1);
#IYF=delta*(1+f)*LKF^(alpha-1);
#GYF=1-IYF-CY;
#CKF=(1-GYF)/(1+f)*LKF^(1-alpha)-delta;
#KF_ss=(wF_ss*(theta_w-1)/theta_w*((1-h)*CKF)^(-sigma_c)*LKF^(-
sigma_l))^(1/(sigma_l+sigma_c));
#CF_ss=CKF*KF_ss;
#IF_ss=delta*KF_ss;
#YF_ss=(CF_ss+IF_ss)/(1-GYF);
#LF_ss=LKF*KF_ss;
#KYF=KF_ss/YF_ss;

//sticky economy
    R=nR-pi(+1);                                                                                                                       //real interest rate
    C=1/(1+h)*C(+1)+h/(1+h)*C(-1)-(1-h)/(sigma_c*(1+h))*(nR-pi(+1))+(1-h)/(sigma_c*(1+h))*eB;                                          //euler equation
    I=beta/(1+beta)*I(+1)+1/(1+beta)*I(-1)+1/(varphi*(1+beta))*Q+x;                                                                    //investment dynamics
    K=delta*(I+varphi*x)+(1-delta)*K(-1);                                                                                              //capital 
    w=beta/(1+beta)*w(+1)+1/(1+beta)*w(-1)+beta/(1+beta)*pi(+1)-(1+beta*gamma_w)/(1+beta)*pi+gamma_w/(1+beta)*pi(-1)                 
      -(1-beta*xi_w)*(1-xi_w)/((1+beta)*(1+theta_w*sigma_l)*xi_w)*(w-sigma_l*L-(sigma_c/(1-h))*(C-h*C(-1)))+ew;                        //wage equation
    L=(1+psi)*rk-w+K(-1);                                                               
    pi=(beta/(1+beta*gamma_p))*pi(+1)+(gamma_p/(1+beta*gamma_p)*pi(-1))+(1-beta*xi_p)*(1-xi_p)/((1+beta*gamma_p)*(xi_p))*mc+ep;        //NKPC
    Rek(+1)=R-varkappa*(NW(+1)-Q-K(+1));                                                                                               //external finance premium                                                                                                           
    Rek=(rk_ss*rk+(1-delta)*Q)/(1-delta+rk_ss)-Q(-1);                                                                                  //ex-post aggregate return to capital
    NW=vartheta_e*(KNW*R_ss*(S_ss*Rek(-1)-R(-1))+KNW*R_ss*(S_ss-1)*(Q(-2)+K(-1))+R_ss*(R(-1)+NW(-1)));                                 //aggregate entrepreneurial net worth
    (E-E(-1))=beta*(E(+1)-E)+(1-xi_e)*((1-beta*xi_e)/xi_e)*(L-E);                                                                      //employment equation
    rk=mc+Y-K(-1);                                                                                                                     //real rental rate
    S=Rek(+1)-R;                                                                                                                       // finance premium
    nR=xi_r*nR(-1)+(1-xi_r)*(xi_pi*pi(-1)+xi_y*(Y(-1)-Y_star(-1)))+xi_deltapi*(pi-pi(-1))                                     
        +xi_deltay*(Y-Y_star-(Y(-1)-Y_star(-1)))+um;                                                                                   //monetary policy
    Y=(1-delta*KY-GY)*C+delta*KY*I+GY*g+KY*psi*rk_ss*rk+KY*(Rek_ss-R_ss)*(1-NWK)*(Rek+Q(-1)+K);                                        //resource constraint
    Y/(1+f)=alpha*(K(-1)+psi*rk)+(1-alpha)*L+A;                                                                                        //production function
//flexible economy
    Y_star=(1-delta*KYF-GYF)*CF+delta*KYF*IF+GYF*g+KYF*psi*rkF_ss*rkF;
    Y_star/(1+f)=alpha*(KF(-1)+psi*rkF)+(1-alpha)*LF+A;     
    CF=(1/(1+h))*CF(+1)+(h/(1+h))*CF(-1)-((1-h)/(sigma_c*(1+h)))*(RF)+((1-h)/(sigma_c*(1+h)))*eB;
    RekF(+1)=RF;
    RekF=(rkF_ss*rkF+(1-delta)*QF)/(1-delta+rkF_ss)-QF(-1);
    rkF=mcF+Y_star-KF(-1);
    IF=(beta/(1+beta))*IF(+1)+(1/(1+beta))*IF(-1)+(1/(varphi*(1+beta)))*QF+x;
    wF=sigma_l*LF+(sigma_c/(1-h))*(CF-h*CF(-1));
    LF=(1+psi)*rkF-wF+KF(-1);
    mcF=0;
    KF=delta*(IF+varphi*x)+(1-delta)*KF(-1); 


//AR(1) shock processes
    eB=rho_B*eB(-1)+uB;        //preference shock
    x=rho_x*x(-1)+ux;          //investment specific shock
    A=rho_A*A(-1)+uA;          //productivity shock   
    g=rho_g*g(-1)+ug;          //government spending shock
    ep=rho_p*ep(-1)+up;
    ew=rho_w*ew(-1)+uw;
    em=rho_m*em(-1)+um;

//measurement equations
   dY = Y -Y(-1) + trend;
   dC=C-C(-1) + trend;
   dI=I-I(-1) + trend;
   dw=w-w(-1) + trend;
   nR_obs=1*nR+ rbar;
   pi_obs=1*pi+ pibar;
   L_obs=1*L+ lbar;

end;

steady;
check;

//shocks
shocks;
    var uB=0.2^2;
    var uw=0.2^2;
    var ux=0.2^2;
    var up=0.2^2;
    var um=0.2^2;
    var uA=0.2^2;
    var ug=0.2^2;
end;

//estimation
estimated_params;
sigma_c,normal_pdf,1.5,0.375;
sigma_l,normal_pdf,5,0.75;
xi_w,beta_pdf,0.5,0.15;
xi_p,beta_pdf,0.5,0.15;
f,normal_pdf,0.45,0.25;
xi_r,beta_pdf,0.8,0.05;
xi_pi,normal_pdf,1.7,0.1;
xi_y,normal_pdf,0.125,0.05;
xi_deltapi,normal_pdf,0.063,0.05;
xi_deltay,normal_pdf,0.3,0.1;
gamma_p,beta_pdf,0.5,0.15;
gamma_w,beta_pdf,0.5,0.15;
varkappa,beta_pdf,0.07,0.03;
vartheta_e,beta_pdf,0.975,0.01;
varphi,normal_pdf,4,1.5;
psi,normal_pdf,0.2,0.075;
xi_e,beta_pdf,0.5,0.15;
rho_B,beta_pdf,0.85,0.1;
rho_x,beta_pdf,0.85,0.1;
rho_A,beta_pdf,0.85,0.1;   
rho_m,beta_pdf,0.85,0.1;
rho_g,beta_pdf,0.85,0.1;
rho_w,beta_pdf,0.85,0.1;
rho_p,beta_pdf,0.85,0.1;
stderr uB,inv_gamma_pdf,0.1,2;
stderr ux,inv_gamma_pdf,0.1,2;
stderr uA,inv_gamma_pdf,0.1,2;
stderr um,inv_gamma_pdf,0.1,2;
stderr ug,inv_gamma_pdf,0.1,2;
stderr uw,inv_gamma_pdf,0.1,2;
stderr up,inv_gamma_pdf,0.1,2;
end;

varobs dY dC dI L_obs pi_obs dw nR_obs;

stoch_simul(hp_filter=40000,irf=20,periods=500) C L I Q NW Y K nR S;

estimation(datafile=data1,mode_compute=6,mh_replic=500000);
d115215315
 
Posts: 1
Joined: Sun Jul 15, 2012 7:23 pm

Return to Dynare help

Who is online

Users browsing this forum: No registered users and 6 guests