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