clear all
close all

% Set parmeters
betanh = 0.99;
betawh = 0.98;
betaph = 0.95;
alphanh = 0.71;
alphawh = 0.26;
j = 0.1;
eta = 1.5;
theta = 0.75;
m = 0.7;
epsilon = 11;
phi = 0.05;
gammaR = 0.73;
gammapi = 0.27;
gammaY = 0.13;
rhoA = 0.95;
sA = 0.01;

% Steady state of non-linear model
pis = 1.02;
Rs = pis/betanh;
rr = 1/(betanh*pis^(gammapi));
pirs = ((1-theta*pis^(epsilon-1))/(1-theta))^(1/(1-epsilon));
vs = ((1-theta)*pirs^(-epsilon))/(1-theta*pis^(epsilon));
mcs = pirs*((epsilon-1)/epsilon)*((1-theta*betanh*pis^(epsilon))/(1-theta*betanh*pis^(epsilon-1)));
Lnhs = ((1-(j*m*(betanh-1))/(1-betawh-m*(betanh-betawh)))*((((1-betanh)*m*j*(1-mcs*(1-alphanh-alphawh)*vs))/(1-betawh-m*(betanh-betawh))+(1-(1-alphanh)*mcs*vs))^(-1))*mcs*alphanh*vs)^(1/eta);
Lwhs = (1-(j*m*(betanh-1))/(1-betawh-m*(betanh-betawh)))^(1/eta);
Lphs = 1;
As = 1;
Ys = (As*(Lnhs^(alphanh))*(Lwhs^(alphawh))*(Lphs^(1-alphanh-alphawh)))/vs;
wnhs = (mcs*alphanh*Ys*vs)/Lnhs;
wwhs = (mcs*alphawh*Ys*vs)/Lwhs;
wphs = (mcs*(1-alphanh-alphawh)*Ys*vs)/Lphs;
cnhs = wnhs/((Lnhs)^(eta-1));
cwhs = wwhs/((Lwhs)^(eta-1));
cphs = wphs/((Lphs)^(eta-1));
qs = ((j*cnhs)/(1-betanh))+((j*cwhs)/(1-betawh-m*(betanh-betawh)));
mus = ((1/cwhs)*(betanh-betawh))/pis;
hnhs = ((j*cnhs)/(1-betanh))/qs;
hwhs = ((j*cwhs)/(1-betawh-m*(betanh-betawh)))/qs;
bwhs = betanh*m*qs*hwhs;
bnhs = -bwhs;
x1s = ((1/cnhs)*mcs*Ys)/(1-theta*betanh*pis^(epsilon));
x2s = ((1/cnhs)*Ys)/(1-theta*betanh*pis^(epsilon-1));
Fs = (1-mcs*vs)*Ys;

save thrank_param_base_nonlin betanh betawh betaph alphanh alphawh j eta theta m epsilon phi gammaR gammapi gammaY rr cnhs cwhs cphs hnhs hwhs Lnhs Lwhs Lphs Ys mcs bnhs bwhs qs Rs wnhs wwhs wphs pis pirs x1s x2s vs As Fs mus rhoA sA

dynare thrank_nonlin.mod noclearall nolog