time | Calls | line |
---|
| | 17 | function [mt_o, mt_coh, mt_k, mt_l]= OC2(varargin)
|
| | 18 |
|
0.001 | 1 | 19 | close all;
|
< 0.001 | 1 | 20 | bl_profile = false; % Switch off profile if running a tester/calling from another function
|
< 0.001 | 1 | 21 | bl_saveimg = true;
|
< 0.001 | 1 | 22 | if(bl_profile)
|
| | 23 | profile off;
|
| | 24 | profile on;
|
| | 25 | end
|
| | 26 |
|
0.383 | 1 | 27 | addpath(genpath('/Users/sidhantkhanna/Documents/GitHub/BKS modified/'));
|
| | 28 |
|
| | 29 | %% Assigning Parameters
|
| | 30 |
|
< 0.001 | 1 | 31 | if ~isempty(varargin)
|
| | 32 |
|
0.002 | 1 | 33 | [ar_a,ar_z, ...
|
| 1 | 34 | fl_alpha,fl_theta,fl_delta,fl_kappa,fl_r,fl_w,fl_phi,fl_ahi,fl_zhi, ...
|
| 1 | 35 | it_zgridno, it_agridno, ...
|
| 1 | 36 | ] = varargin{:};
|
| | 37 |
|
< 0.001 | 1 | 38 | bl_print = false;
|
< 0.001 | 1 | 39 | bl_plot = false;
|
| | 40 |
|
| | 41 |
|
| | 42 | else
|
| | 43 | close all;
|
| | 44 |
|
| | 45 | fl_ahi = 5;
|
| | 46 | fl_zhi = 2.5;
|
| | 47 | it_agridno = 5;
|
| | 48 | it_zgridno = 6;
|
| | 49 | ar_a = linspace(0,fl_ahi,it_agridno);
|
| | 50 | ar_z = linspace(1.2,fl_zhi,it_zgridno);
|
| | 51 | fl_phi = 0.5;
|
| | 52 |
|
| | 53 | fl_alpha = 0.4;
|
| | 54 | fl_theta = 0.79-fl_alpha;
|
| | 55 | fl_delta = 0.05;
|
| | 56 | fl_kappa = 0;
|
| | 57 |
|
| | 58 | [fl_r,fl_w,fl_ahi] = ...
|
| | 59 | deal(0.05,1.5,100);
|
| | 60 | bl_print = true;
|
| | 61 | bl_plot = true;
|
| | 62 |
|
< 0.001 | 1 | 63 | end
|
| | 64 |
|
< 0.001 | 1 | 65 | fl_R = fl_r + fl_delta;
|
| | 66 |
|
0.003 | 1 | 67 | [a_m,z_m] = meshgrid(ar_a,ar_z);
|
< 0.001 | 1 | 68 | a_m = a_m';
|
< 0.001 | 1 | 69 | z_m = z_m';
|
| | 70 |
|
| | 71 | %% Making Occupational choice
|
| | 72 |
|
1.008 | 1 | 73 | [mt_k_star, mt_l_star] = optikl(ar_a,ar_z, ...
|
| 1 | 74 | fl_alpha,fl_theta,fl_delta,fl_kappa,fl_r,fl_w,fl_phi,fl_ahi,fl_zhi, ...
|
| 1 | 75 | it_zgridno, it_agridno);
|
| | 76 |
|
< 0.001 | 1 | 77 | mt_wage = fl_w.*ones(it_agridno, it_zgridno);
|
< 0.001 | 1 | 78 | mt_profit = z_m.*(mt_k_star.^fl_alpha).*(mt_l_star.^fl_theta) - fl_R.*mt_k_star - fl_w.*mt_l_star - ((1+fl_r)*(fl_kappa)).*ones(it_agridno, it_zgridno);
|
< 0.001 | 1 | 79 | mt_o = zeros(it_agridno, it_zgridno);
|
< 0.001 | 1 | 80 | mt_o(mt_wage<mt_profit) = 1; % Matrix for Occupational Choice
|
< 0.001 | 1 | 81 | mt_income = max(mt_wage,mt_profit); % Matrix for Income
|
< 0.001 | 1 | 82 | mt_coh = mt_income + a_m.*(1+fl_r); % Matrix for COH
|
< 0.001 | 1 | 83 | mt_k = mt_k_star;
|
< 0.001 | 1 | 84 | mt_l = mt_l_star;
|
< 0.001 | 1 | 85 | mt_k(mt_o==0) = 0; % If you choose worker, you do not rent any capital
|
< 0.001 | 1 | 86 | mt_l(mt_o==0) = 0; % If you choose worker, you do not hire any workers
|
| | 87 |
|
| | 88 | %% Printing Outputs
|
| | 89 |
|
< 0.001 | 1 | 90 | if(bl_print)
|
| | 91 | disp('Below is mt_wage');
|
| | 92 | disp(mt_wage);
|
| | 93 | disp('Below is mt_profit ');
|
| | 94 | disp(mt_profit );
|
| | 95 | disp('Below is mt_o ');
|
| | 96 | disp(mt_o);
|
| | 97 | disp('Below is mt_income');
|
| | 98 | disp(mt_income);
|
| | 99 | disp('Below is mt_coh');
|
| | 100 | disp(mt_coh);
|
| | 101 | disp('Below is mt_k');
|
| | 102 | disp(mt_k);
|
| | 103 | disp('Below is mt_l');
|
| | 104 | disp(mt_l);
|
| | 105 | end
|
| | 106 |
|
| | 107 |
|
< 0.001 | 1 | 108 | if(bl_plot)
|
| | 109 | figure(1)
|
| | 110 | imagesc(ar_a,ar_z,mt_o');
|
| | 111 | set(gca,'YDir','normal')
|
| | 112 | xlabel('assets','FontSize', 20);
|
| | 113 | ylabel('Entrepreneurial productivity','FontSize', 20);
|
| | 114 | if(bl_saveimg)
|
| | 115 | saveas(gcf, '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Households/figures/OC2/OC2.png');
|
| | 116 | end
|
| | 117 | end
|
| | 118 |
|
< 0.001 | 1 | 119 | if(bl_profile)
|
| | 120 | profile off;
|
| | 121 | profile viewer;
|
| | 122 | st_file_name = '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Profile/Households/OC2';
|
| | 123 | profsave(profile('info'), st_file_name);
|
| | 124 |
|
| | 125 | end
|
Other subfunctions in this file are not included in this listing.