% This program states the deep structural parameters and computes the
% steady state of the model. 
%



function [ys,check] = NK_house_steadystate(ys,exe)

global M_
 %% /!\ DESCRIPTION OF THE FUNCTION /!\ 
    
%% /!\ DO NOT CHANGE THIS PART /!\

%%

%% Here I load the values of the deep parameters in a loop.

%%
NumberOfParameters = M_.param_nbr;                            % Number of deep parameters.

for i = 1:NumberOfParameters                                  % Loop...

    paramname = deblank(M_.param_names(i,:));                 % Get the name of parameter i. 
  
    eval([ paramname ' = M_.params(' int2str(i) ');']);       % Get the value of parameter i.

end                                                           % End of the loop.  

check = 0;

%% END OF THE FIRST MODEL INDEPENDENT BLOCK.
%%
%% THIS BLOCK IS MODEL SPECIFIC.
%%
%% Here the user has to define some parameters and the steady state.
%%
%% CALCULATING THE STEADY STATE VALUES

% Steady State level of Employment

Ns = 1/3; %1             

Nb = 1/3; %2             

Pi = 1;   %3                 % Gross Inflation Rate

Zz = 1;    

Zr = 1;  

%% First I compute the Steady State Values of the Endogeneous Variables

Ptil = 1;%4            % relative price of optimizing firms

MC = (EPS-1)/EPS;%5    % real marginal cost

R = Pi/BETAS; %6       % nominal interest rate

Y = Zz*(Ns)^ALFA*(Nb)^(1-ALFA); %7

Ws = ALFA*MC*Y/Ns; %8

Wb = (1-ALFA)*MC*Y/Nb; %9

F1 = Y/(1-BETAS*THETA); %10

F2 = F1*MC; %11

LAM = BETAS-BETAB; %12

Cb = Wb*Nb/(1-((BETAS-1)*Mn*JEI/(1-(LAM*Mn)-BETAB))); %13

Cs = Y-Cb; %14

Q = JEI*Cs/(1-BETAS) + JEI*Cb/(1-LAM*Mn-BETAB); %15

D = (Cb-Wb*Nb)/(1-R); %16

Hb = D*R/(Mn*Q); %17

Hs = 1-Hb; %18

chis = Ws/((Ns)^(etaa-1)*Cs); %19

chib = Wb/((Nb)^(etaa-1)*Cb); %20

%% Third I assign long run levels (Xstars) to the endogenous variables.

cs = log(Cs);
cb = log(Cb);
y = log(Y);
ws = log(Ws);
wb = log(Wb);
q = log(Q);
hs = log(Hs);
hb = log(Hb);
ns = log(Ns);
nb = log(Nb);
mc = log(MC);
pi = log(Pi);
d = log(D);
r = log(R);
zz = log(Zz);
zr = log(Zr);
f1 = log(F1);
f2 = log(F2);
ptil = log(Ptil);
lam = log(LAM);

%%
%% END OF THE MODEL SPECIFIC BLOCK.
%%
%% DO NOT CHANGE THIS PART.
%%
%% Here I put the steady state levels in the vector ys 
%%
NumberOfEndogenousVariables = M_.endo_nbr;                    % Number of endogenous variables.

ys = zeros(NumberOfEndogenousVariables,1);                    % Initialization of ys (steady state).

for i = 1:NumberOfEndogenousVariables                         % Loop...
  
    varname = deblank(M_.endo_names(i,:));                      %    Get the name of endogenous variable i.                     

    eval(['ys(' int2str(i) ') = ' varname ';']);                %    Get the steady state value of this variable.

end                                                           % End of the loop.

%%
%% Finally I update parameters A and PSI in the global workspace  
%%
id1 = strmatch('Pi',M_.param_names,'exact');                   % Get the index of A in M_.params
M_.params(id1) = Pi;
id2 = strmatch('R',M_.param_names,'exact');                    % Get the index of A in M_.params
M_.params(id2) = R;
id3 = strmatch('Y',M_.param_names,'exact');                    % Get the index of A in M_.params
M_.params(id3) = Y;
id4 = strmatch('chis',M_.param_names,'exact');                 % Get the index of A in M_.params
M_.params(id4) = chis;
id5 = strmatch('chib',M_.param_names,'exact');                 % Get the index of A in M_.params
M_.params(id5) = chib;

%%
%% END OF THE SECOND MODEL INDEPENDENT BLOCK.