% Foreign aid and its volatility %__________________________________________________________________________ %1. Defining variables %__________________________________________________________________________  % List of endogenous variables var yt yn Y Ct Cn C Kt Kn K  Lt L i x1 pn epsx epsn epst pc; % List of exogenuous variables varexo e1 e2 e3;  parameters beta omega mu sigma alpha eta delta nu At An sigmax sigman sigmat  X psi11 psi12 psi13 psi21 psi22 psi23 psi31 psi32 psi33;  %__________________________________________________________________________ % 2. Calibration %__________________________________________________________________________  beta  = 0.95; omega = 0.26; mu = 0.3157; delta =  0.05; alpha = 0.3; eta   = 0.5; sigma = 5.00; nu= -10.09; At    = 1; An    = 1.52; sigmax = 0.74; sigman= 0.11; sigmat= 0.11; X     = 1.32; psi11 = 0.95; psi12 = 0; psi13 = 0; psi21 = 0.95; psi22 = 0; psi23 = 0; psi31 = 0.95; psi32 = 0; psi33 = 0;    klt=((1-beta+beta*delta)/(alpha*beta*At))^(1/(alpha-1));                        %Kt/Lt kln=((1-alpha)/(1-eta))*(eta/alpha)*(klt);                                      %Kn/Ln  ky_t= (beta*alpha)/(1+beta*delta-beta);                                         %Kt/yt kpy_n= (eta*beta)/(1+beta*delta-beta);                                          %Kn/pn*yn knkt=1/(1+nu);                                                                  %Kn/Kt                          %__________________________________________________________________________ % 3. Model %__________________________________________________________________________ model; %households:  (C^(-sigma))/pc=beta*(C(+1)^(-sigma))/(pc(+1))*(1- delta + alpha*At*exp(epst(+1))*(Kt(+1)/Lt(+1))^(alpha-1)) ;     % Euler equation  pn = ((1-omega)/omega)*(Cn/Ct)^(-(1+eta));                                     % Marginal rate of substitution between consumptin of tradable and non-tradable goods  pc=(omega^(1/(1+eta))+((1-omega)^(1/(1+eta)))*pn^(eta/(1+eta)))^((1+eta)/eta);  %Firms:  pn*An*exp(epsn)*eta*(Kn/L)^(eta-1)=At*exp(epst)*alpha*(Kt/Lt)^(alpha-1);       % Marginal productivity of capital/The rate of return pn*An*exp(epsn)*(1-eta)*(Kn/L)^eta =At*exp(epst)*(1-alpha)*(Kt/Lt)^alpha ;     % Marginal productivity of labor/ The wage rate     %Market Clearing/Resource constrains  yt=At*exp(epst)*(Kt^alpha)*Lt^(1-alpha);                                      % Output in tradable sector yn=An*exp(epsn)*(Kn^eta)*L^(1-eta);                                           % Output in non-tradable sector Y= pn*yn+yt;                                                                  % GDP  K(+1)= i+ (1-delta)*K;                                                         % Capital Accumulation K=(Kt^(-nu)+Kn^(-nu))^(-1/nu);                                                 % Capital sector specifiation  Ct+i = yt + x1 ;                                                              % Maret clearing condition in the sector of tradable goods Cn = An*exp(epsn)*(Kn^eta)*L^(1-eta);                                         % Market clearing condition in the sector of non-tradable goods  C=((1-omega)*(Cn)^(-mu)+omega*(Ct)^(-mu))^(-1/mu);                           % Total consumption  Lt+L=1;                                                                      % Labor Market, market clearing condition  x1=X*exp(epsx) ;                                                              % Aid          log(epsx)=psi11*log(epsx(-1)) + psi12*log(epsn(-1))+psi13*log(epst(-1))+e1;   %Aid shock log(epsn)=psi21*log(epsn(-1)) + psi22*log(epsx(-1))+psi23*log(epst(-1))+e2;  %non-tradable sector productivity shock log(epst)=psi31*log(epst(-1)) + psi32*log(epsx(-1))+psi33*log(epsn(-1))+e3;  %tradable sector productivity shock   end;  %__________________________________________________________________________ %4.Computation %__________________________________________________________________________  initval;  pn=((1-alpha)/(1-eta))*(At/An)*((klt)^alpha)*(kln)^(-eta);                      %marginal rate of substitution between consumption of tradable and non-tradable secotrs pc=(omega^(1/(1+eta))+((1-omega)^(1/(1+eta)))*pn^(eta/(1+eta)))^((1+eta)/eta); Lt=1/(1+((1-eta)*alpha/((1-alpha)*eta))*knkt); L=1-Lt;  yt=At*((klt)^alpha)*Lt; yn=An*((kln)^eta)*L; Y=yt+pn*yn;  Ct=yn*(pn*omega/(1-omega))^(1/1+eta); Cn=yn; C=((1-omega)*(Cn)^(-mu)+omega*(Ct)^(-mu))^(-1/mu);  Kt=yt*ky_t; Kn=yn*pn*kpy_n; K=(Kt^(-nu)+Kn^(-nu))^(-1/nu);  i=delta*K; x1=exp(1)*X;    e1=0; e2=0; e3=0; epsx=1; epsn=1; epst=1;  end;  shocks; var e1=sigmax^2; var e2=sigman^2; var e3=sigmat^2; var e1,e2=0.4*sigmax*sigman; var e1,e3=0.4*sigmax*sigmat; var e2,e3=0.4*sigman*sigmat; end;  steady;  stoch_simul(hp_filter = 1600, order = 1);                                    % calculates the theoretical moments. HP-filtering before.