Partial Equilbrium - 2OC

This function solves the 2 OC model outcomes given interest rate and wages Back to full code page https://kritikhanna.github.io/BKS-modified/

Function Inputs : asset grid(1 by M) and entrepreneurial productivity grid(1 by N) relevant model parameters required Calls function hhsave_VFI_2OC.m

Function Outputs :

function [fl_y, mt_dis, mt_o, mt_k, mt_l]= PE_2OC(varargin)
addpath(genpath('/Users/sidhantkhanna/Desktop/Research/Matlab Code/My codes'));

close all;
bl_profile = false;      % Switch off profile if running a tester/calling from another function
bl_saveimg = true;
if(bl_profile)
profile off;
profile on;
end

addpath(genpath('/Users/sidhantkhanna/Documents/GitHub/BKS modified/'));

if ~isempty(varargin)

    [ar_a,ar_z, ...
        fl_alpha,fl_theta,fl_delta,fl_kappa,fl_r,fl_w,fl_phi,fl_ahi,fl_zhi, ...
         fl_risk,it_zgridno, it_agridno,mt_trans_z,fl_beta, fl_mu, fl_sig,fl_rho, fl_tolvfi, fl_toldis,  ...
        ] = varargin{:};

    bl_print  = true;
    bl_plot   = false;


else
    close all;

    fl_ahi         = 100;
    fl_zhi         = 2.2;
    it_agridno     = 5;
    it_zgridno     = 6;
    ar_a           = linspace(0,fl_ahi,it_agridno);
    fl_phi         = 0.5;
    fl_risk        = 1;
    fl_alpha       = 0.4;
    fl_theta       = 0.79-fl_alpha;
    fl_delta       = 0.05;
    fl_kappa       = 0;
    fl_mu          = 0;                   % mean of AR(1) entrepeneurial productivity process
    fl_rho         = 0.9;                 % persistence parameter of the AR(1) entrepreneurial productivity process
    fl_sig         = 0.2;
    fl_lambda      = 3;
    fl_beta        = 0.92;
    [ar_z, mt_trans_z] = mytauchen_z(fl_mu,fl_rho,fl_sig,it_zgridno,fl_lambda);
    ar_z           = exp(ar_z);
    fl_r           = 0.02;
    fl_w           = 1.5;
    fl_tolvfi      = 10^-12;
    fl_toldis      = 10^-12;              % Tolerance level for convergence stationary distribution
    bl_print       = true;

end

fl_R  = fl_r + fl_delta;

% Calling VFI

[mt_dis, mt_o, mt_k, mt_l]=hhsave_dis_2OC(ar_a,ar_z, ...
        fl_alpha,fl_theta,fl_delta,fl_kappa,fl_r,fl_w,fl_phi,fl_ahi,fl_zhi, ...
         fl_risk,it_zgridno, it_agridno,mt_trans_z,fl_beta, fl_mu, fl_sig,fl_rho, fl_tolvfi, fl_toldis);

% Total Output

fl_y=sum(sum(mt_dis.*mt_k.^fl_alpha.*mt_l.^fl_theta));

% Total Capital
Below is the Stationary Distribution
    0.0040    0.0268    0.0692    0.0692    0.0268    0.0040
    0.0000    0.0000    0.0000    0.0000    0.0000    0.0000
    0.0161    0.1073    0.2764    0.2711    0.0872    0.0032
    0.0000    0.0000    0.0003    0.0029    0.0047    0.0026
    0.0000    0.0000    0.0000    0.0026    0.0154    0.0103


ans =

    4.2529