time | Calls | line |
---|
| | 21 | function [mt_o, mt_coh, mt_k, mt_l]= OC3(varargin)
|
| | 22 |
|
| | 23 | close all;
|
| | 24 | bl_profile = true; % Switch off profile if running a tester/calling from another function
|
| | 25 | bl_saveimg = false;
|
| | 26 | if(bl_profile)
|
| | 27 | profile off;
|
| | 28 | profile on;
|
< 0.001 | 1 | 29 | end
|
| | 30 |
|
0.446 | 1 | 31 | addpath(genpath('/Users/sidhantkhanna/Documents/GitHub/BKS modified/'));
|
| | 32 |
|
| | 33 |
|
< 0.001 | 1 | 34 | if ~isempty(varargin)
|
| | 35 |
|
| | 36 | [ar_a,ar_z,ar_s ...
|
| | 37 | fl_alpha,fl_theta,fl_delta,fl_kappa,fl_r,fl_w,fl_phi,fl_ahi,fl_zhi, ...
|
| | 38 | it_zgridno, it_agridno,it_sgridno ...
|
| | 39 | ] = varargin{:};
|
| | 40 |
|
| | 41 | bl_print = false;
|
| | 42 | bl_plot = false;
|
| | 43 |
|
| | 44 |
|
< 0.001 | 1 | 45 | else
|
0.017 | 1 | 46 | close all;
|
| | 47 |
|
< 0.001 | 1 | 48 | fl_ahi = 5;
|
< 0.001 | 1 | 49 | fl_zhi = 2.2;
|
< 0.001 | 1 | 50 | it_agridno = 5;
|
< 0.001 | 1 | 51 | it_zgridno = 6;
|
< 0.001 | 1 | 52 | it_sgridno = 2;
|
0.004 | 1 | 53 | ar_a = linspace(0,fl_ahi,it_agridno);
|
< 0.001 | 1 | 54 | ar_z = linspace(1,fl_zhi,it_zgridno);
|
< 0.001 | 1 | 55 | ar_s = [0,1];
|
< 0.001 | 1 | 56 | fl_phi = 0.5;
|
| | 57 |
|
< 0.001 | 1 | 58 | fl_alpha = 0.4;
|
< 0.001 | 1 | 59 | fl_theta = 0.79-fl_alpha;
|
< 0.001 | 1 | 60 | fl_delta = 0.05;
|
< 0.001 | 1 | 61 | fl_kappa = 0;
|
| | 62 |
|
< 0.001 | 1 | 63 | [fl_r,fl_w,fl_ahi] = ...
|
| 1 | 64 | deal(0.05,1,100);
|
< 0.001 | 1 | 65 | bl_print = true;
|
< 0.001 | 1 | 66 | bl_plot = true;
|
| | 67 |
|
< 0.001 | 1 | 68 | end
|
| | 69 |
|
< 0.001 | 1 | 70 | fl_R = fl_r + fl_delta;
|
| | 71 |
|
0.003 | 1 | 72 | [a_m,z_m] = meshgrid(ar_a,ar_z)
|
< 0.001 | 1 | 73 | a_m = a_m';
|
< 0.001 | 1 | 74 | z_m = z_m';
|
< 0.001 | 1 | 75 | a_m_3OC = repmat (a_m, [1 1 it_sgridno]);
|
< 0.001 | 1 | 76 | z_m_3OC = repmat (z_m, [1 1 it_sgridno]);
|
| | 77 |
|
| | 78 | %% Making Occupational choice
|
| | 79 |
|
0.816 | 1 | 80 | [k_star, l_star] = optikl(ar_a,ar_z, ...
|
| 1 | 81 | fl_alpha,fl_theta,fl_delta,fl_kappa,fl_r,fl_w,fl_phi,fl_ahi,fl_zhi, ...
|
| 1 | 82 | it_zgridno, it_agridno)
|
< 0.001 | 1 | 83 | k_star_3OC = repmat (k_star, [1 1 it_sgridno]);
|
< 0.001 | 1 | 84 | l_star_3OC = repmat (l_star, [1 1 it_sgridno]);
|
| | 85 |
|
< 0.001 | 1 | 86 | mt_wage = fl_w.*ones(it_agridno, it_zgridno, it_sgridno);
|
0.019 | 1 | 87 | mt_profit = z_m_3OC.*(k_star_3OC.^fl_alpha).*(l_star_3OC.^fl_theta) - fl_R.*k_star_3OC - fl_w.*l_star_3OC - ((1+fl_r)*(fl_kappa)).*ones(it_agridno, it_zgridno, it_sgridno);
|
< 0.001 | 1 | 88 | mt_o = zeros(it_agridno, it_zgridno,it_sgridno);
|
< 0.001 | 1 | 89 | mt_o(mt_wage<mt_profit) = 2; % Matrix for Occupational Choice
|
< 0.001 | 1 | 90 | mt_o(mt_wage(:,:,1)>mt_profit(:,:,1)) = 1; % Assigning 1 for self-employed category
|
0.001 | 1 | 91 | mt_income = max(mt_wage,mt_profit); % Matrix for Income
|
< 0.001 | 1 | 92 | mt_coh = mt_income + a_m_3OC.*(1+fl_r); % Matrix for COH
|
0.002 | 1 | 93 | mt_k = k_star_3OC;
|
< 0.001 | 1 | 94 | mt_l = l_star_3OC;
|
< 0.001 | 1 | 95 | mt_k(mt_o==0) = 0;
|
< 0.001 | 1 | 96 | mt_l(mt_o==0) = 0;
|
| | 97 |
|
| | 98 |
|
< 0.001 | 1 | 99 | if(bl_print)
|
0.005 | 1 | 100 | disp('Below is mt_wage')
|
0.006 | 1 | 101 | disp(size(mt_wage));
|
< 0.001 | 1 | 102 | disp('Below is mt_profit ')
|
< 0.001 | 1 | 103 | disp(mt_profit );
|
< 0.001 | 1 | 104 | disp('Below is mt_o ')
|
< 0.001 | 1 | 105 | disp(mt_o);
|
< 0.001 | 1 | 106 | disp('Below is mt_income')
|
< 0.001 | 1 | 107 | disp(mt_income);
|
< 0.001 | 1 | 108 | disp('Below is mt_coh')
|
< 0.001 | 1 | 109 | disp(mt_coh);
|
< 0.001 | 1 | 110 | disp('Below is mt_k');
|
0.001 | 1 | 111 | disp(mt_k);
|
< 0.001 | 1 | 112 | disp('Below is mt_l');
|
< 0.001 | 1 | 113 | disp(mt_l);
|
< 0.001 | 1 | 114 | end
|
| | 115 |
|
| | 116 |
|
< 0.001 | 1 | 117 | if(bl_plot)
|
0.075 | 1 | 118 | figure(1)
|
0.008 | 1 | 119 | colormap( [1 0 1; 1 0 1; 1 1 0] )
|
0.040 | 1 | 120 | imagesc(ar_a,ar_z,mt_o(:,:,1)');
|
< 0.001 | 1 | 121 | set(gca,'YDir','normal')
|
0.015 | 1 | 122 | title('OC no labor skills, Pink = SE, Yellow = Ent','FontSize',20);
|
0.008 | 1 | 123 | xlabel('assets','FontSize', 20);
|
0.008 | 1 | 124 | ylabel('Entrepreneurial productivity','FontSize', 20);
|
< 0.001 | 1 | 125 | if(bl_saveimg)
|
| | 126 | saveas(gcf, '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Households/figures/OC3/OC3_nolaskills.png')
|
| | 127 | end
|
| | 128 |
|
0.052 | 1 | 129 | figure(2)
|
< 0.001 | 1 | 130 | colormap( [1 1 1; 1 0 0; 1 1 0] )
|
0.010 | 1 | 131 | imagesc(ar_a,ar_z,mt_o(:,:,2)');
|
< 0.001 | 1 | 132 | set(gca,'YDir','normal')
|
0.010 | 1 | 133 | title('OC with labor skills, White = worker, Yellow = Ent','FontSize',20);
|
0.004 | 1 | 134 | xlabel('assets','FontSize', 20);
|
0.005 | 1 | 135 | ylabel('Entrepreneurial productivity','FontSize', 20);
|
< 0.001 | 1 | 136 | if(bl_saveimg)
|
| | 137 | saveas(gcf, '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Households/figures/OC3/OC3_laskills.png')
|
| | 138 | end
|
< 0.001 | 1 | 139 | end
|
| | 140 |
|
< 0.001 | 1 | 141 | if(bl_profile)
|
0.005 | 1 | 142 | profile off;
|
| | 143 | profile viewer;
|
| | 144 | st_file_name = '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Profile/Households/OC3';
|
| | 145 | profsave(profile('info'), st_file_name);
|
| | 146 | end
|
Other subfunctions in this file are not included in this listing.