LambdaSDFV = beta; % #2ThetaV %+++
PiV = Pis;
RdV = Pis/beta; % #4 ??? Pis in st.st. nehmen? %+++
pstarV = ((1-phip*Pis^((1-epsp)*(gammap-1)))/(1-phip))^(1/(1-epsp));%+++         % #39 ??? Pis in st.st. nehmen? 
vpV = (1-phip)*(pstarV)^(-epsp)/(1-phip*(Pis)^(epsp*(1-gammap)));%+++            % #21 ??? Pis in st.st. nehmen? 
RFV = (1+sp)^(1/4)*RdV; %+++ % !!!! das habe ich jetzt aus der Datei der Autoren übernommen!! sp steht für spread? sp=0.03 das ist aus der Parameter-Datei. 
% Bedeutet das, dass der Jahreszins 3% ist? und nehmen es hoch 1/4 um den
% in Quartal umzurechenn? Ist das dann eine Annahme?
RBV = delta*(RFV-RdV) + RdV;%+++
QV = 1/(RFV - kappa);%+++
QBV = 1/(RBV - kappa);%+++
M2V = LambdaSDFV*(Pis)^(-1)/(QV*(1 - kappa*LambdaSDFV*(Pis)^(-1)));%+++
M1V = psi*(M2V - 1) + 1;%+++
% pstarV = epsp/(epsp-1)*x1V/x2V; instead of this one I have eq 100
pmV = pstarV*(epsp-1)/epsp*(1-phip*LambdaSDFV*(Pis)^((epsp)*(1-gammap)))/(1-phip*LambdaSDFV*(Pis)^((gammap-1)*(1-epsp)));%+++ % eq.100
KV = ((alpha*pmV)/(M1V/LambdaSDFV - (1-delta0)*M1V))^(1/(1-alpha));%+++
YmV = KV^alpha; %+++
YV = YmV/vpV;%+++
x1V = pmV*YV/(1-phip*LambdaSDFV*(Pis)^((epsp)*(1-gammap)));%+++
x2V = YV/(1-phip*LambdaSDFV*(Pis)^((gammap-1)*(1-epsp)));%+++
wV = (1-alpha)*pmV*KV^alpha;%+++
wstarV = ((wV^(1-epsw)*(1-phiw*Pis^((epsw-1)*(1-gammaw))))/(1-phiw))^(1/(1-epsw));%+++
% wstarV = epsw/(epsw-1)*f1V/f2V; anstatt das haben wir eq. 101;
mrsV = wstarV*(epsw-1)/epsw*(1- phiw*LambdaSDFV*(Pis)^((1-gammaw)*epsw))/(1-phiw*LambdaSDFV*(Pis/(Pis^(gammaw)))^(epsw-1));%+++ % eq. 101
f1V = mrsV*wV^(epsw)/(1- phiw*LambdaSDFV*(Pis)^((1-gammaw)*epsw));%+++
f2V = wV^epsw/(1-phiw*LambdaSDFV*(Pis/(Pis^(gammaw)))^(epsw-1));%+++
%!!!!!M1V = alpha*pmV*KV^(alpha-1)/delta1 ; % !!!!!!!!!!!!!!!!!!!!!!!!!!! ?? I cannot find this equation in their steady state model
vwV = ((1-phiw)*(wstarV/wV)^(-epsw))/(1-phiw*Pis^(epsw*(1-gammaw)));%+++
LV = vwV;%+++
IhatV = delta0*KV;%+++
IV = IhatV;%+++
GV = GVs;%+++
CV = YV - GV - IV; %+++% they do this GV = GVs;
muV = 1/CV*(1/(1-b) - b*beta/(1-b));%+++ 
%muV = Chi*LV^eta/mrsV; % they have this eq. to derive the parameter Chi
% pk=1
fmV = (psi*IhatV)/(QV*(1-kappa*Pis^(-1)));%+++ 
fcbV = fcbVs;%+++  % our first assumption
fV = fmV - fcbV;%+++ 
bcbV = bcbVs;%+++  % our second assumption
reV = QV*fcbV + QBV*bcbV;%+++ 
bGV = bGVs;%+++  % our third assumption
bV = bGV - bcbV;%+++ 
RTRV = RdV; %+++ % prove this one!!
RreV = RTRV;%+++ 
TcbV = (1+kappa*QV)*Pis^(-1)*fcbV + (1+kappa*QBV)*Pis^(-1)*bcbV - RreV*Pis^(-1)*reV;%+++ 
TV = GV + bGV*Pis^(-1) - (TcbV + QBV*(bGV - kappa*bGV*Pis^(-1)));%+++ 
nV = (QV*fV + QBV*bV + reV)/levs;%+++  % our forth assumption. Here we assume that leverage of financial intermediaries is constant in st.st. -> net worth is fractionof total assets of fin.int
dV = QV*fV + QBV*bV + reV - nV;%+++ 
phiV = (QV*fV + delta*QBV*bV)/nV; % this equation is not in their model steady state because phi=phis= to this equation in their param_ss.m file
ThetaV = ((1-sigma)*phiV*LambdaSDFV*Pis^(-1)*(RFV - RdV)+(1-sigma)*Pis^(-1)*LambdaSDFV*RdV) / (phiV-sigma*phiV^2*LambdaSDFV*(Pis)^(-1)*(RFV-RdV)-phiV*sigma*(Pis)^(-1)*LambdaSDFV*RdV);
OmegaV = 1-sigma + sigma*ThetaV*phiV;%+++ 
lambdaV = (ThetaV/(LambdaSDFV*OmegaV*Pis^(-1)*(RFV-RdV))-1)^-1;%+++ 
omegaV = (RdV - RreV)*(1+lambdaV)*Pis^(-1)*OmegaV*LambdaSDFV;%+++ 


ys = [  1; % why not 0?
    GV;
    ThetaV;
    muV;
    CV;
    LV;
    mrsV;
    RdV;
    PiV;
    wstarV;
    f1V;
    f2V;
    pstarV;
    x1V;
    x2V;
    pmV;
    YV;
    YmV;
    1; %uV;
    KV;
    1; %LdV;
    IhatV;
    1; %pkV;
    QV;
    omegaV;
    wV;
    M1V;
    LambdaSDFV;
    M2V;
    IV;
    RFV;
    RBV;
    OmegaV;
    RreV;
    lambdaV;
    phiV;
    reV;
    nV;
    fmV;
    TV;
    TcbV;
    QBV;
    fcbV;
    bcbV;
    RTRV;
    fV;
    bV;
    vwV;
    vpV;
    dV; 
    bGV;
];


