time | Calls | line |
---|
| | 17 | function [mt_vf, mt_pf, mt_oploc, mt_o, mt_k, mt_l]=hhsave_VFI_3OC(varargin)
|
| | 18 |
|
| | 19 | close all;
|
| | 20 | bl_profile = true; % Switch off profile if running a tester/calling from another function
|
| | 21 | bl_saveimg = true;
|
| | 22 | if(bl_profile)
|
| | 23 | profile off;
|
| | 24 | profile on;
|
< 0.001 | 1 | 25 | end
|
| | 26 |
|
0.703 | 1 | 27 | addpath(genpath('/Users/sidhantkhanna/Documents/GitHub/BKS modified/'));
|
| | 28 |
|
< 0.001 | 1 | 29 | if ~isempty(varargin)
|
| | 30 |
|
| | 31 | [ar_a,ar_z,ar_n, ...
|
| | 32 | fl_alpha,fl_theta,fl_delta,fl_kappa,fl_r,fl_w,fl_phi,fl_ahi,fl_zhi, ...
|
| | 33 | fl_risk,it_zgridno, it_agridno,it_ngridno, mt_trans_z,mt_trans_n,fl_beta, fl_mu_z, fl_sig_z, ...
|
| | 34 | fl_rho_z,fl_lambda_z,fl_mu_n, fl_sig_n,fl_rho_n,fl_lambda_n, fl_tolvfi ...
|
| | 35 | ] = varargin{:};
|
| | 36 |
|
| | 37 | bl_print = false;
|
| | 38 | bl_plot = false;
|
| | 39 |
|
| | 40 |
|
< 0.001 | 1 | 41 | else
|
| | 42 |
|
< 0.001 | 1 | 43 | fl_ahi = 50;
|
< 0.001 | 1 | 44 | fl_alo = 0;
|
< 0.001 | 1 | 45 | fl_zhi = 2.2;
|
< 0.001 | 1 | 46 | it_agridno = 100;
|
< 0.001 | 1 | 47 | it_zgridno = 7;
|
< 0.001 | 1 | 48 | it_ngridno = 2;
|
| | 49 | % ar_a = linspace(fl_alo ,fl_ahi,it_agridno);
|
| | 50 | % mp_grid_control = containers.Map('KeyType','char', 'ValueType','any');
|
| | 51 | % mp_grid_control('grid_powerspace_power') = 2;
|
| | 52 | % ar_a = ff_saveborr_grid(fl_alo, fl_ahi, it_agridno, mp_grid_control)
|
0.007 | 1 | 53 | ar_a = ff_saveborr_grid(fl_alo, fl_ahi, it_agridno, 'grid_powerspace');
|
< 0.001 | 1 | 54 | ar_a = ar_a';
|
< 0.001 | 1 | 55 | fl_phi = 0.5;
|
< 0.001 | 1 | 56 | fl_risk = 1.5;
|
< 0.001 | 1 | 57 | fl_alpha = 0.4;
|
< 0.001 | 1 | 58 | fl_theta = 0.79-fl_alpha;
|
< 0.001 | 1 | 59 | fl_delta = 0.05;
|
< 0.001 | 1 | 60 | fl_kappa = 0;
|
< 0.001 | 1 | 61 | fl_mu_z = 0; % mean of AR(1) entrepeneurial productivity process
|
< 0.001 | 1 | 62 | fl_rho_z = 0.9; % persistence parameter of the AR(1) entrepreneurial productivity process
|
< 0.001 | 1 | 63 | fl_sig_z = 0.02;
|
< 0.001 | 1 | 64 | fl_lambda_z = 3;
|
< 0.001 | 1 | 65 | fl_beta = 0.92;
|
| | 66 | % [ar_z, mt_trans_z] = mytauchen_z(fl_mu_z,fl_rho_z,fl_sig_z,it_zgridno,fl_lambda_z);
|
0.015 | 1 | 67 | [ar_z, mt_trans_z] = ffy_rouwenhorst(fl_rho_z,fl_sig_z,it_zgridno);
|
< 0.001 | 1 | 68 | ar_z = exp(ar_z);
|
0.004 | 1 | 69 | P1=mt_trans_z^1000;
|
< 0.001 | 1 | 70 | sd=P1(1,:);
|
< 0.001 | 1 | 71 | el=sd*ar_z;
|
< 0.001 | 1 | 72 | ar_z =ar_z/el;
|
< 0.001 | 1 | 73 | ar_z = ar_z';
|
< 0.001 | 1 | 74 | ar_n = [0,1];
|
< 0.001 | 1 | 75 | mt_trans_n = [0.1,0.9;0.9,0.1];
|
| | 76 |
|
| | 77 |
|
< 0.001 | 1 | 78 | [fl_r,fl_w] = ...
|
| 1 | 79 | deal(0.02,1);
|
< 0.001 | 1 | 80 | fl_tolvfi = 10^-12;
|
| | 81 |
|
< 0.001 | 1 | 82 | bl_print = true;
|
< 0.001 | 1 | 83 | bl_plot = true;
|
| | 84 |
|
< 0.001 | 1 | 85 | end
|
| | 86 |
|
< 0.001 | 1 | 87 | fl_R = fl_r + fl_delta;
|
| | 88 |
|
| | 89 | %% Value function Iteration
|
| | 90 |
|
< 0.001 | 1 | 91 | mt_vf = zeros(it_agridno,it_zgridno,it_ngridno); % Value function
|
< 0.001 | 1 | 92 | mt_Tv = zeros(it_agridno,it_zgridno,it_ngridno); % Next guess of value function
|
< 0.001 | 1 | 93 | mt_oploc = zeros(it_agridno,it_zgridno,it_ngridno); %
|
| | 94 |
|
4.882 | 1 | 95 | [mt_util,mt_coh, mt_k, mt_l, mt_o] = hhsave_util_3OC(ar_a,ar_z,ar_n, ...
|
| 1 | 96 | fl_alpha,fl_theta,fl_delta,fl_kappa,fl_r,fl_w,fl_phi,fl_ahi,fl_zhi, ...
|
| 1 | 97 | fl_risk,it_zgridno, it_agridno,it_ngridno);
|
| | 98 |
|
< 0.001 | 1 | 99 | fl_crit = 1; % difference between current and next guess of value function
|
< 0.001 | 1 | 100 | mt_evf = zeros(it_agridno,it_zgridno,it_ngridno);
|
< 0.001 | 1 | 101 | while fl_crit > fl_tolvfi
|
| | 102 |
|
< 0.001 | 365 | 103 | for i = 1:it_ngridno
|
0.011 | 730 | 104 | mt_evf(:,:,i) = mt_vf(:,:,i)*mt_trans_z';
|
< 0.001 | 730 | 105 | end
|
< 0.001 | 365 | 106 | for j = 1:it_zgridno
|
0.075 | 2555 | 107 | mt_evf1(:,j,:) = squeeze(mt_evf(:,j,:))*mt_trans_n';
|
< 0.001 | 2555 | 108 | end
|
| | 109 |
|
0.034 | 365 | 110 | mt_ev1 = repmat(mt_evf1, [1 1 1 it_agridno]);
|
0.060 | 365 | 111 | mt_ev1 = permute(mt_ev1,[4 2 3 1]);
|
| | 112 |
|
0.120 | 365 | 113 | [mt_Tvf,mt_oploc] = max((mt_util+fl_beta.*(mt_ev1)),[], 4);
|
| | 114 |
|
0.002 | 365 | 115 | mt_diff = mt_Tvf-mt_vf;
|
0.001 | 365 | 116 | mt_diff = mt_diff(:);
|
0.001 | 365 | 117 | fl_crit = norm(mt_diff);
|
< 0.001 | 365 | 118 | mt_vf = mt_Tvf;
|
< 0.001 | 365 | 119 | end
|
| | 120 |
|
| | 121 |
|
< 0.001 | 1 | 122 | mt_pf = ar_a(mt_oploc);
|
< 0.001 | 1 | 123 | mt_con = mt_coh - mt_pf;
|
< 0.001 | 1 | 124 | mt_savefraccoh = mt_pf./mt_coh;
|
| | 125 |
|
< 0.001 | 1 | 126 | if(bl_print)
|
| | 127 |
|
0.014 | 1 | 128 | st_ar_a = strsplit(num2str(ar_a));
|
< 0.001 | 1 | 129 | for i=1:it_agridno
|
0.012 | 100 | 130 | st_a(i) =strcat('a=', st_ar_a(i));
|
< 0.001 | 100 | 131 | end
|
0.002 | 1 | 132 | st_ar_z = strsplit(num2str(ar_z));
|
< 0.001 | 1 | 133 | disp('Table for value function at l=0');
|
0.075 | 1 | 134 | tb_VF = array2table(mt_vf(:,:,1),'VariableNames',{'z1','z2','z3','z4','z5','z6','z7'});
|
0.027 | 1 | 135 | tb_VF.Properties.RowNames = st_a;
|
0.073 | 1 | 136 | disp(tb_VF);
|
< 0.001 | 1 | 137 | disp('Table for value function at l=1');
|
0.011 | 1 | 138 | tb_VF = array2table(mt_vf(:,:,2),'VariableNames',{'z1','z2','z3','z4','z5','z6','z7'});
|
0.001 | 1 | 139 | tb_VF.Properties.RowNames = st_a;
|
0.044 | 1 | 140 | disp(tb_VF);
|
< 0.001 | 1 | 141 | disp('Table for Policy function at l=0');
|
0.002 | 1 | 142 | tb_pf = array2table(mt_pf(:,:,1),'VariableNames',{'z1','z2','z3','z4','z5','z6','z7'});
|
0.002 | 1 | 143 | tb_pf.Properties.RowNames = st_a;
|
0.007 | 1 | 144 | disp(tb_pf);
|
< 0.001 | 1 | 145 | disp('Table for Policy function at l=1');
|
0.001 | 1 | 146 | tb_pf = array2table(mt_pf(:,:,2),'VariableNames',{'z1','z2','z3','z4','z5','z6','z7'});
|
< 0.001 | 1 | 147 | tb_pf.Properties.RowNames = st_a;
|
0.008 | 1 | 148 | disp(tb_pf);
|
< 0.001 | 1 | 149 | disp('Table for Consumption at l=0 ');
|
0.002 | 1 | 150 | tb_con = array2table(mt_con(:,:,1),'VariableNames',{'z1','z2','z3','z4','z5','z6','z7'});
|
0.002 | 1 | 151 | tb_con.Properties.RowNames = st_a;
|
0.007 | 1 | 152 | disp(tb_con);
|
< 0.001 | 1 | 153 | disp('Table for Consumption at l=1 ');
|
0.003 | 1 | 154 | tb_con = array2table(mt_con(:,:,2),'VariableNames',{'z1','z2','z3','z4','z5','z6','z7'});
|
0.001 | 1 | 155 | tb_con.Properties.RowNames = st_a;
|
0.007 | 1 | 156 | disp(tb_con);
|
< 0.001 | 1 | 157 | disp('Table for Savings/COH at l=0');
|
0.001 | 1 | 158 | tb_savefraccoh = array2table(mt_savefraccoh(:,:,1),'VariableNames',{'z1','z2','z3','z4','z5','z6','z7'});
|
< 0.001 | 1 | 159 | tb_savefraccoh.Properties.RowNames = st_a;
|
0.007 | 1 | 160 | disp(tb_savefraccoh);
|
< 0.001 | 1 | 161 | disp('Table for Savings/COH at l=1');
|
0.001 | 1 | 162 | tb_savefraccoh = array2table(mt_savefraccoh(:,:,2),'VariableNames',{'z1','z2','z3','z4','z5','z6','z7'});
|
< 0.001 | 1 | 163 | tb_savefraccoh.Properties.RowNames = st_a;
|
0.007 | 1 | 164 | disp(tb_savefraccoh);
|
| | 165 |
|
< 0.001 | 1 | 166 | end
|
| | 167 |
|
| | 168 |
|
| | 169 |
|
| | 170 | %% Plot Value function and Policy Function
|
| | 171 |
|
| | 172 | % 3D Value function - l=0
|
< 0.001 | 1 | 173 | if(bl_plot)
|
| | 174 |
|
0.057 | 1 | 175 | figure(1)
|
0.123 | 1 | 176 | surf(ar_z,ar_a,mt_vf(:,:,1));
|
0.019 | 1 | 177 | title('Value Function, l=0');
|
0.008 | 1 | 178 | xlabel('Productivity') ;
|
0.008 | 1 | 179 | ylabel('Assets');
|
0.013 | 1 | 180 | zlabel('Value');
|
0.004 | 1 | 181 | xt = get(gca, 'XTick');
|
< 0.001 | 1 | 182 | set(gca, 'XTick', xt, 'XTickLabel', xt*fl_ahi/it_agridno);
|
< 0.001 | 1 | 183 | if(bl_saveimg)
|
0.518 | 1 | 184 | saveas(gcf, '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Households/figures/hhsave_VFI_3OC/Valuefunction_3D_0.png')
|
< 0.001 | 1 | 185 | end
|
| | 186 |
|
0.006 | 1 | 187 | figure(2)
|
0.030 | 1 | 188 | surf(ar_z,ar_a,mt_vf(:,:,2));
|
0.015 | 1 | 189 | title('Value Function, l=1');
|
0.007 | 1 | 190 | xlabel('Productivity') ;
|
0.006 | 1 | 191 | ylabel('Assets');
|
0.006 | 1 | 192 | zlabel('Value');
|
0.004 | 1 | 193 | xt = get(gca, 'XTick');
|
< 0.001 | 1 | 194 | set(gca, 'XTick', xt, 'XTickLabel', xt*fl_ahi/it_agridno);
|
< 0.001 | 1 | 195 | if(bl_saveimg)
|
0.560 | 1 | 196 | saveas(gcf, '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Households/figures/hhsave_VFI_3OC/Valuefunction_3D_1.png')
|
< 0.001 | 1 | 197 | end
|
| | 198 |
|
| | 199 | % 2D Value function
|
0.060 | 1 | 200 | figure(3)
|
| | 201 | %chart = plot(mt_vf);
|
< 0.001 | 1 | 202 | for i = 1: it_zgridno
|
0.029 | 7 | 203 | a(i) = plot((mt_vf(:,i,1)), '.');
|
0.007 | 7 | 204 | b{i} = sprintf(['Z shock =', num2str(ar_z(i))]);
|
0.014 | 7 | 205 | hold on
|
< 0.001 | 7 | 206 | end
|
0.004 | 1 | 207 | clr = jet(numel(a));
|
< 0.001 | 1 | 208 | for m = 1:numel(a)
|
0.002 | 7 | 209 | set(a(m),'Color',clr(m,:))
|
< 0.001 | 7 | 210 | end
|
0.341 | 1 | 211 | legend(b,'Location','South')
|
| | 212 | %clr = jet(numel(chart));
|
| | 213 | %for m = 1:numel(chart)
|
| | 214 | % set(chart(m),'Color',clr(m,:))
|
| | 215 | %end
|
0.215 | 1 | 216 | title('Value Function, l=0');
|
0.028 | 1 | 217 | xlabel('Asset') ;
|
0.026 | 1 | 218 | ylabel('Value');
|
0.024 | 1 | 219 | xt = get(gca, 'XTick');
|
0.001 | 1 | 220 | set(gca, 'XTick', xt, 'XTickLabel', xt*fl_ahi/it_agridno);
|
< 0.001 | 1 | 221 | if(bl_saveimg)
|
1.138 | 1 | 222 | saveas(gcf, '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Households/figures/hhsave_VFI_3OC/Valuefunction_2D_0.png')
|
< 0.001 | 1 | 223 | end
|
| | 224 |
|
0.052 | 1 | 225 | figure(4)
|
| | 226 | %chart = plot(mt_vf);
|
< 0.001 | 1 | 227 | for i = 1: it_zgridno
|
0.024 | 7 | 228 | a(i) = plot((mt_vf(:,i,2)),'.');
|
0.002 | 7 | 229 | b{i} = sprintf(['Z shock =', num2str(ar_z(i))]);
|
0.006 | 7 | 230 | hold on
|
< 0.001 | 7 | 231 | end
|
< 0.001 | 1 | 232 | clr = jet(numel(a));
|
< 0.001 | 1 | 233 | for m = 1:numel(a)
|
0.001 | 7 | 234 | set(a(m),'Color',clr(m,:))
|
< 0.001 | 7 | 235 | end
|
0.051 | 1 | 236 | legend(b,'Location','South')
|
| | 237 | %clr = jet(numel(chart));
|
| | 238 | %for m = 1:numel(chart)
|
| | 239 | % set(chart(m),'Color',clr(m,:))
|
| | 240 | %end
|
0.033 | 1 | 241 | title('Value Function, l=1');
|
0.026 | 1 | 242 | xlabel('Asset') ;
|
0.025 | 1 | 243 | ylabel('Value');
|
0.024 | 1 | 244 | xt = get(gca, 'XTick');
|
0.001 | 1 | 245 | set(gca, 'XTick', xt, 'XTickLabel', xt*fl_ahi/it_agridno);
|
< 0.001 | 1 | 246 | if(bl_saveimg)
|
1.046 | 1 | 247 | saveas(gcf, '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Households/figures/hhsave_VFI_3OC/Valuefunction_2D_1.png')
|
< 0.001 | 1 | 248 | end
|
| | 249 |
|
| | 250 |
|
0.051 | 1 | 251 | figure(5)
|
< 0.001 | 1 | 252 | for i = 1: it_zgridno
|
0.026 | 7 | 253 | a(i) = plot((mt_pf(:,i,1)),'.');
|
0.002 | 7 | 254 | b{i} = sprintf(['Z shock =', num2str(ar_z(i))]);
|
0.005 | 7 | 255 | hold on
|
< 0.001 | 7 | 256 | end
|
< 0.001 | 1 | 257 | clr = jet(numel(a));
|
< 0.001 | 1 | 258 | for m = 1:numel(a)
|
0.001 | 7 | 259 | set(a(m),'Color',clr(m,:))
|
< 0.001 | 7 | 260 | end
|
0.049 | 1 | 261 | legend(b,'Location','north')
|
0.033 | 1 | 262 | title('Policy Function,l=0');
|
0.025 | 1 | 263 | xlabel('Asset') ;
|
0.025 | 1 | 264 | ylabel('Asset Choice');
|
0.022 | 1 | 265 | xt = get(gca, 'XTick');
|
0.001 | 1 | 266 | set(gca, 'XTick', xt, 'XTickLabel', xt*fl_ahi/it_agridno);
|
< 0.001 | 1 | 267 | if(bl_saveimg)
|
0.975 | 1 | 268 | saveas(gcf, '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Households/figures/hhsave_VFI_3OC/Policyfunction_0.png')
|
< 0.001 | 1 | 269 | end
|
| | 270 |
|
0.052 | 1 | 271 | figure(6)
|
< 0.001 | 1 | 272 | for i = 1: it_zgridno
|
0.026 | 7 | 273 | a(i) = plot((mt_pf(:,i,2)),'.');
|
0.002 | 7 | 274 | b{i} = sprintf(['Z shock =', num2str(ar_z(i))]);
|
0.007 | 7 | 275 | hold on
|
< 0.001 | 7 | 276 | end
|
< 0.001 | 1 | 277 | clr = jet(numel(a));
|
< 0.001 | 1 | 278 | for m = 1:numel(a)
|
0.002 | 7 | 279 | set(a(m),'Color',clr(m,:))
|
< 0.001 | 7 | 280 | end
|
0.073 | 1 | 281 | legend(b,'Location','north')
|
0.032 | 1 | 282 | title('Policy Function, l=1');
|
0.027 | 1 | 283 | xlabel('Asset') ;
|
0.027 | 1 | 284 | ylabel('Asset choice');
|
0.024 | 1 | 285 | xt = get(gca, 'XTick');
|
0.001 | 1 | 286 | set(gca, 'XTick', xt, 'XTickLabel', xt*fl_ahi/it_agridno);
|
< 0.001 | 1 | 287 | if(bl_saveimg)
|
0.953 | 1 | 288 | saveas(gcf, '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Households/figures/hhsave_VFI_3OC/Policyfunction_1.png')
|
< 0.001 | 1 | 289 | end
|
| | 290 |
|
0.073 | 1 | 291 | figure(7)
|
< 0.001 | 1 | 292 | for i = 1: it_zgridno
|
0.027 | 7 | 293 | a(i) = plot((mt_con(:,i,1)),'-o');
|
0.002 | 7 | 294 | b{i} = sprintf(['Z shock =', num2str(ar_z(i))]);
|
0.006 | 7 | 295 | hold on
|
< 0.001 | 7 | 296 | end
|
< 0.001 | 1 | 297 | clr = jet(numel(a));
|
< 0.001 | 1 | 298 | for m = 1:numel(a)
|
0.001 | 7 | 299 | set(a(m),'Color',clr(m,:))
|
< 0.001 | 7 | 300 | end
|
0.050 | 1 | 301 | legend(b,'Location','north')
|
0.032 | 1 | 302 | title('Consumption,l=0');
|
0.026 | 1 | 303 | xlabel('Asset') ;
|
0.026 | 1 | 304 | ylabel('Consumption');
|
0.033 | 1 | 305 | xt = get(gca, 'XTick');
|
0.001 | 1 | 306 | set(gca, 'XTick', xt, 'XTickLabel', xt*fl_ahi/it_agridno);
|
< 0.001 | 1 | 307 | if(bl_saveimg)
|
1.330 | 1 | 308 | saveas(gcf, '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Households/figures/hhsave_VFI_3OC/Consumption_0.png')
|
< 0.001 | 1 | 309 | end
|
| | 310 |
|
0.048 | 1 | 311 | figure(8)
|
< 0.001 | 1 | 312 | for i = 1: it_zgridno
|
0.024 | 7 | 313 | a(i) = plot((mt_con(:,i,2)),'-o');
|
0.002 | 7 | 314 | b{i} = sprintf(['Z shock =', num2str(ar_z(i))]);
|
0.005 | 7 | 315 | hold on
|
< 0.001 | 7 | 316 | end
|
< 0.001 | 1 | 317 | clr = jet(numel(a));
|
< 0.001 | 1 | 318 | for m = 1:numel(a)
|
0.001 | 7 | 319 | set(a(m),'Color',clr(m,:))
|
< 0.001 | 7 | 320 | end
|
0.049 | 1 | 321 | legend(b,'Location','north')
|
0.032 | 1 | 322 | title('Consumption, l=1');
|
0.026 | 1 | 323 | xlabel('Asset') ;
|
0.026 | 1 | 324 | ylabel('Consumption');
|
0.024 | 1 | 325 | xt = get(gca, 'XTick');
|
< 0.001 | 1 | 326 | set(gca, 'XTick', xt, 'XTickLabel', xt*fl_ahi/it_agridno);
|
< 0.001 | 1 | 327 | if(bl_saveimg)
|
0.689 | 1 | 328 | saveas(gcf, '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Households/figures/hhsave_VFI_3OC/Consumption_1.png')
|
< 0.001 | 1 | 329 | end
|
| | 330 |
|
0.087 | 1 | 331 | figure(9)
|
< 0.001 | 1 | 332 | for i = 1: it_zgridno
|
0.028 | 7 | 333 | a(i) = plot(mt_savefraccoh(:,i,1),'-o');
|
0.003 | 7 | 334 | b{i} = sprintf(['Z shock =', num2str(ar_z(i))]);
|
0.007 | 7 | 335 | hold on
|
< 0.001 | 7 | 336 | end
|
< 0.001 | 1 | 337 | clr = jet(numel(a));
|
< 0.001 | 1 | 338 | for m = 1:numel(a)
|
0.004 | 7 | 339 | set(a(m),'Color',clr(m,:))
|
< 0.001 | 7 | 340 | end
|
0.102 | 1 | 341 | legend(b,'Location','South')
|
0.032 | 1 | 342 | title('SavingsfracCOH,l=0');
|
0.025 | 1 | 343 | xlabel('Asset') ;
|
0.026 | 1 | 344 | ylabel('SavingsfracCOH');
|
0.009 | 1 | 345 | ylim([0 1])
|
0.024 | 1 | 346 | xt = get(gca, 'XTick');
|
< 0.001 | 1 | 347 | set(gca, 'XTick', xt, 'XTickLabel', xt*fl_ahi/it_agridno);
|
< 0.001 | 1 | 348 | if(bl_saveimg)
|
1.390 | 1 | 349 | saveas(gcf, '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Households/figures/hhsave_VFI_3OC/Savings_COH_0.png')
|
< 0.001 | 1 | 350 | end
|
| | 351 |
|
0.060 | 1 | 352 | figure(10)
|
< 0.001 | 1 | 353 | for i = 1: it_zgridno
|
0.030 | 7 | 354 | a(i) = plot(mt_savefraccoh(:,i,2),'-o');
|
0.002 | 7 | 355 | b{i} = sprintf(['Z shock =', num2str(ar_z(i))]);
|
0.007 | 7 | 356 | hold on
|
< 0.001 | 7 | 357 | end
|
< 0.001 | 1 | 358 | clr = jet(numel(a));
|
< 0.001 | 1 | 359 | for m = 1:numel(a)
|
0.001 | 7 | 360 | set(a(m),'Color',clr(m,:))
|
< 0.001 | 7 | 361 | end
|
0.062 | 1 | 362 | legend(b,'Location','South')
|
0.037 | 1 | 363 | title('SavingsfracCOH, l=1');
|
0.030 | 1 | 364 | xlabel('Asset') ;
|
0.028 | 1 | 365 | ylabel('SavingsfracCOH');
|
0.001 | 1 | 366 | ylim([0 1])
|
0.025 | 1 | 367 | xt = get(gca, 'XTick');
|
< 0.001 | 1 | 368 | set(gca, 'XTick', xt, 'XTickLabel', xt*fl_ahi/it_agridno);
|
< 0.001 | 1 | 369 | if(bl_saveimg)
|
0.799 | 1 | 370 | saveas(gcf, '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Households/figures/hhsave_VFI_3OC/Savings_COH_1.png')
|
< 0.001 | 1 | 371 | end
|
| | 372 |
|
| | 373 |
|
< 0.001 | 1 | 374 | end
|
| | 375 |
|
| | 376 |
|
| | 377 |
|
| | 378 | %% Plot Value function and Policy Function
|
| | 379 |
|
< 0.001 | 1 | 380 | if(bl_profile)
|
0.006 | 1 | 381 | profile off;
|
| | 382 | profile viewer;
|
| | 383 | st_file_name = '/Users/sidhantkhanna/Documents/GitHub/BKS modified/code/Profile/Households/hhsave_VFI_3OC';
|
| | 384 | profsave(profile('info'), st_file_name);
|
| | 385 | end
|
Other subfunctions in this file are not included in this listing.