

close all
eta = 1;
etapound = 1;
chi = 0.06;
chipound = 0.06;
alpha = 0.7;
alphapound = 0.7;
beta = 0.99;
betapound = 0.99;
theta = 0.75;
thetapound = 0.75;
epsilon = 6;
epsilonpound = 6;
omega = 2;
omegapound = 2;
phi = 0.9;
phipound = 0.9;


pis = 1;
pipounds = 1;
pims = 1;
pimpounds = 1;
pifs = 1;
pifpounds = 1;
pifstars = 1;
pifstarpounds = 1;
psis = 1;
psipounds = 1;
As = 1;
Apounds = 1;
Ns = 1/3;
Npounds = 1/3;
CMs = 1;
es = 6.8;


Rs = 1/beta;
Rpounds = 1/betapound;
Z1 = (alpha*(epsilon-1)*As*Ns^(1-alpha)/epsilon)^(1/(1-alpha));
Z2 = (alphapound*(epsilonpound-1)*Apounds*Npounds^(1-alphapound)/epsilonpound)^(1/(1-alphapound));
Z3 = (alpha*(epsilon-1)*As^(1/alpha)/epsilon)^(alpha/(1-alpha))*Ns;
Z4 = (alphapound*(epsilonpound-1)*Apounds^(1/alphapound)/epsilonpound)^(alphapound/(1-alphapound))*Npounds;
syms pHs pFs qs pCMs
[pHs pFs qs pCMs] = vpasolve(phi*(pHs)^(1-omega)+(1-phi)*(pFs)^(1-omega)==1,phipound*(pFs/qs)^(1-omegapound)+(1-phipound)*(pHs/qs)^(1-omegapound)==1,...
   Z1*(pHs/pCMs)^(1/(1-alpha))+Z2*(pFs/pCMs)^(1/(1-alphapound))==1,...
  (phi*qs*pHs^(-omega)+(1-phipound)*(pHs/qs)^(-omegapound))/(phipound*(pFs/qs)^(-omegapound)+(1-phi)*qs*pFs^(-omega)) ==...
  (Z3*(pHs/pCMs)^(alpha/(1-alpha)))/(Z4*(pFs/pCMs)^(alphapound/(1-alphapound))),pHs,pFs,qs,pCMs);
pHpounds = pHs/qs;
pFpounds = pFs/qs;
pCMpounds = pCMs/qs;
pms = pHs*(epsilon-1)/epsilon;
pmpounds = pFpounds*(epsilonpound-1)/epsilonpound;
CMes = Z1*(pHs/pCMs)^(1/(1-alpha));
CMepounds = Z2*(pFs/pCMs)^(1/(1-alphapound));
Ys = As*CMes^alpha*Ns^(1-alpha);
Ypounds = Apounds*CMepounds^alphapound*Npounds^(1-alphapound);
Cpounds = Ys/(phi*qs*pHs^(-omega)+(1-phipound)*pHpounds^(-omegapound));
Cs = qs*Cpounds;
CHs = phi*Cs*pHs^(-omega);
CHpounds = (1-phipound)*Cpounds*pHpounds^(-omegapound);
CFs = (1-phi)*Cs*pFs^(-omega);
CFpounds = phipound*Cpounds*pFpounds^(-omegapound);
ws = (1-alpha)*pms*Ys/Ns;
wpounds = (1-alphapound)*pmpounds*Ypounds/Npounds;
ms = chi*Rs*Cs/((Rs-1)*psis);
mpounds = chipound*Rpounds*Cpounds/((Rpounds-1)*psipounds);
kappa = ws*psis/(Cs*Ns^eta);
kappapound = wpounds*psipounds/(Cpounds*Npounds^etapound); 
x1s = psis*Ys*pms/(Cs*(1-theta*beta*pifs^epsilon));
x1pounds = psipounds*Ypounds*pmpounds/(Cpounds*(1-thetapound*betapound*pifpounds^epsilonpound));
x2s = psis*Ys/(Cs*(1-theta*beta*pifs^epsilon*pis^(-1)));
x2pounds = psipounds*Ypounds/(Cpounds*(1-thetapound*betapound*pifpounds^epsilonpound*pipounds^(-1)));
qs = eval(qs);
CFs = eval(CFs);
CFpounds = eval(CFpounds);
CHs = eval(CHs);
CHpounds = eval(CHpounds);
CMes = eval(CMes);
CMepounds = eval(CMepounds);
Cs = eval(Cs);
Cpounds = eval(Cpounds);
kappa = eval(kappa);
kappapound = eval(kappapound);
ms = eval(ms);
mpounds = eval(mpounds);
pCMs = eval(pCMs);
pCMpounds = eval(pCMpounds);
pFs = eval(pFs);
pFpounds = eval(pFpounds);
pHs = eval(pHs);
pHpounds = eval(pHpounds);
pms = eval(pms);
pmpounds = eval(pmpounds);
ws = eval(ws);
wpounds = eval(wpounds);
x1s = eval(x1s);
x1pounds = eval(x1pounds);
x2s = eval(x2s);
x2pounds = eval(x2pounds);
Ys = eval(Ys);
Ypounds = eval(Ypounds);




rhopsi = 0.5;
rhopsipound = 0.5;
rhoA = 0.4;
rhoApound = 0.2;
rhoCM = 0.7;
rhoR = 0.9;
rhoRpound = 0.9;
rhopi = 1.5;
rhopipound = 1.5;
rhoY = 0.1;
rhoYpound = 0.1;
rhoe = 0.5;
sdpsi =0.05;
sdpsipound = 0.0;
sdA = 0.01;
sdApound = 0.0;
sdCM = 0.01;
sdR = 0.01;
sdRpound = 0.01;


save steadystate


dynare cpippiestimation1 












