%MOD3SS   computes the steady state for model 3 with parameters given.  
%         See appendices in SR452 for details.

%         Ellen McGrattan, 4-10-09
%         Revised, ERM, 8-20-09

beta    = 0.9800;
delt    = 0.035798051524159;
deli    = 0.0000;
gn      = 0.0100;
gz      = 0.0190;
psi     = 2.054894082446453;
thet1   = 0.235985385913277;
alph1   = 0.112690158973017;
thet2   = 0.235985385913277;
alph2   = 0.112690158973017;
chi     = 0.5000;
z1      = 1.928364445745426;
z2      = 1.250191878006843;
q       = 1;
tauc    = 0.0269;
tauh    = 0.0322;
taub    = 0.0322;
taux    = 0.;
tauk    = 0.0143;
taup    = 0.1107;
tauu    = 0.;
taud    = 0.0847;
g       = 0.0581;
hn      = 0.0741;
xn      = 0.1497;
yn      = 0.3625;

param   = [beta;delt;deli;gn;gz;psi;thet1;alph1;thet2;alph2;chi;tauc;tauh;
           taux;tauk;taup;tauu;taud;z1;z2;g;yn;xn;hn];
X0      = [1.7157 1.7841 0.6807 0.1115]';

X1      = secant('foc3ss0',X0,param);
X1      = secant('foc3ss0',real(X1),param);
[r,V]   = foc3ss0(X1,param);

kt      = X1(1);
ki      = X1(2);
c       = X1(3);
xt      = X1(4);
k2t     = V(1);   
h2      = V(2);   
y       = V(3);   
qxi     = V(4);   
xi      = V(5);   
c       = V(6);   
h       = V(7);   
xt      = V(8);   
k1t     = V(9);
h1      = V(10);
w       = V(11);
rt      = V(12);
ri      = V(13);
txc     = tauc*c;
txh     = tauh*(w*(h-hn)-(1-chi)*q*xi);
txx     = taux*xt;
txk     = tauk*kt;
txp     = taup*((rt-delt-tauk)*kt+ri*ki-chi*q*xi);
txu     = tauu*(xt-delt*kt);
txd     = taud*((rt-tauk)*kt-xt-txx-txp-txu);
tx      = txc+txh+txx+txk+txp+txu+txd;


disp('Parameter Values for Model 3')
disp('----------------------------')
disp('  Preferences')
disp(sprintf('    Discount factor                    %8.4f',beta))
disp(sprintf('    Utility curvature                  %8.4f',0.))
disp(sprintf('    Utility weight                     %8.4f',psi))
disp('  Growth rates')
disp(sprintf('    Population                         %8.4f',gn))
disp(sprintf('    Technology                         %8.4f',gz))
disp('  Depreciation rates')
disp(sprintf('    Tangible                           %8.4f',delt))
disp(sprintf('    Intangible                         %8.4f',deli))
disp('  Capital Shares')
disp(sprintf('    Tangible, final g&s production     %8.4f',thet1))
disp(sprintf('    Intangible, final g&s production   %8.4f',alph1))
disp(sprintf('    Tangible, intangible production    %8.4f',thet2))
disp(sprintf('    Intangible, intangible production  %8.4f',alph2))
disp('  Tax rates on')
disp(sprintf('    Consumption                        %8.4f',tauc))
disp(sprintf('    Labor (of worker)                  %8.4f',tauh))
disp(sprintf('    Labor (of business owner)          %8.4f',tauh))
disp(sprintf('    Investment                         %8.4f',taux))
disp(sprintf('    Property                           %8.4f',tauk))
disp(sprintf('    Profits                            %8.4f',taup))
disp(sprintf('    Unidstributed profits              %8.4f',tauu))
disp(sprintf('    Dividends                          %8.4f',taud))
disp('  Levels of technology')
disp(sprintf('    Final g&s production               %8.4f',z1))
disp(sprintf('    Intangible production              %8.4f',z2))
disp('  Non-business activity ')
disp(sprintf('    Hours                              %8.4f',hn))
disp(sprintf('    Investment                         %8.4f',xn))
disp(sprintf('    Output                             %8.4f',yn))
disp('  Fraction of intangible expensed from ')
disp(sprintf('    Compensation                       %8.4f',1-chi))
disp(sprintf('    Profits                            %8.4f',chi))
disp(' ')
disp('Steady State for Model 3')
disp('------------------------')
disp('  Consumptions ')
disp(sprintf('    Private                            %8.4f',c))
disp(sprintf('    Public                             %8.4f',g))
disp('  Investments')
disp(sprintf('    Tangible                           %8.4f',xt))
disp(sprintf('    Intangible                         %8.4f',xi))
disp(sprintf('    Nonbusiness                        %8.4f',xn))
disp('  Outputs')
disp(sprintf('    Business                           %8.4f',y))
disp(sprintf('    Nonbusiness                        %8.4f',yn))
disp('  Incomes')
disp(sprintf('    Business                           %8.4f',y))
disp(sprintf('      Labor income                     %8.4f', ...
                                       w*(h1+h2)-(1-chi)*q*xi))
disp(sprintf('      Capital income                   %8.4f', ...
                                       rt*kt+ri*ki-chi*q*xi-delt*kt))
disp(sprintf('      Depreciation                     %8.4f',delt*kt))
disp(sprintf('    Nonbusiness                        %8.4f',yn))
disp('  Capital Stocks ')
disp(sprintf('    Tangible                           %8.4f',kt))
disp(sprintf('      in final g&s production          %8.4f',k1t))
disp(sprintf('      in intangible production         %8.4f',k2t))
disp(sprintf('    Intangible                         %8.4f',ki))
disp('  Hours ')
disp(sprintf('    Business                           %8.4f',h-hn))
disp(sprintf('      in final g&s production          %8.4f',h1))
disp(sprintf('      in intangible production         %8.4f',h2))
disp(sprintf('    Nonbusiness                        %8.4f',hn))
disp('  Taxes ')
disp(sprintf('    Consumption                        %8.4f',txc))
disp(sprintf('    Labor                              %8.4f',txh))
disp(sprintf('    Investment                         %8.4f',txx))
disp(sprintf('    Property                           %8.4f',txk))
disp(sprintf('    Profits                            %8.4f',txp))
disp(sprintf('    Undistributed profits              %8.4f',txu))
disp(sprintf('    Dividends                          %8.4f',txd))
disp(sprintf('    TOTAL                              %8.4f',tx))
disp(sprintf('  Transfers                            %8.4f',tx-g))
