% Borrowing, Credit, Index Insurance, and Technical Transformation % Mario J. Miranda & Katie Farrin % Dept of Agricultural, Environmental & Development Economics % The Ohio State University % February 23, 2014 % Regimes % 1) No farmer has access to insurance. % 2) Decision to borrow and/or insure are independent. % 3) Borrowers must insure, but receive indemnity. % 4) Borrowers must insure and must assign indemnities to lender. % The availability of insurance, all or borrowers only, may be set % independently for each regime using the array "avail" below. % State Variables % w = cash % i1 = credit-worthy (1) or -unworthy (0) % i2 = indebted (1) or debt-free (0) % i3 = insured (1) or not (0) % i4 = drought (1) or no drought (0) % Action Variables % x = savings % j1 = repay (1) or default (0) % j2 = borrow (1) or not (0) % j3 = insure (1) or not (0) % j4 = high-yield (1) or low-yield (0) technology % Preliminary Tasks close all clear all fprintf('\n\n\nCredit, Index Insurance, and Technical Transformation\n') tic %% PARAMETERS % Basic Parameters Nr = 4; % number of insurance-credit scenarios Nu = 2; % number of subsidization scenarios Ns = 2; % number of savings scenarios Ni = 4; % number of discrete states Nj = 4; % number of discrete actions % Scenario Labels Regname = {'No Insurance','Optional Insurance','Mandatory Insurance','Contingent Credit'}; Savename = {'Without Savings', 'With Savings'}; Subname = {'Unsubsidized Insurance', 'Subsidized Insurance'}; % Scenarios Simulated Rsim = [1 2 3 4]; % credit regimes Ssim = [1]; % savings regimes - 1==no savings; 2==savings Usim = [2]; % insurance subsidy regimes - 1==unsubsidized; 2==subsidized % Numerical Control Parameters nw = 300; % number of basis functions and nodes nx = 501; % number of discretized continuous actions m = 5; % number of discretized idiosyncratic shocks % Simulation Control Parameters nrep = 10000; % number of agents simulated nper = 100; % number of periods simulated for ergodic distribution npast = 16; % Base Case Model Parameters rho = 0.1; % discount rate rs = 0.0; % interest rate on savings rl = 0.2; % interest rate on loans R = 0.65; % rate of return on high-yield technology alpha = 2.0; % relative risk aversion gamma = 0.0; % default stigma utility penalty mu = 1/50; % credit reinstatement probability bary = [1.0;1.35]; % expected yield, normal year, per technology beta = [0.4;0.65]; % percent yield shortfall, drought year, per technology sigma = [0.1;0.1]; % idiosyncratic yield shock volatility, per technology p = 0.2; % probability of drought eta = 1.0; % portion of loan insured theta = [0.3;-0.5]; % premium load, unsubsidized and subsidized xmax = 3.0; % maximum savings, when allowed avail = [0 1 0 0]; % 1 insurance available to all, 0 available only to borrowers, per insurance-credit scenario % Derived Parameters delta = 1/(1+rho); % discount factor ymean = bary.*(1-beta*p); % expected yields K = (ymean(2)-ymean(1))/(1+R); % cost of high-yield technology L = K; % loan size % Parameter Checks if ymean(2)1), error('Invalid Parameter'), end if theta(2)>0||theta(1)<0, error('Invalid Parameter'), end %% SOLVE AND SIMULATE % Initialize output array wpath = zeros(nper+npast,Nr,Ns,Nu); xpath = zeros(nper+npast,Nr,Ns,Nu); i1path = zeros(nper+npast,Nr,Ns,Nu); j2path = zeros(nper+npast,Nr,Ns,Nu); j3path = zeros(nper+npast,Nr,Ns,Nu); j4path = zeros(nper+npast,Nr,Ns,Nu); nloans = zeros(nper+npast,Nr,Ns,Nu); nrepay = zeros(nper+npast,Nr,Ns,Nu); ttt = tic; it = 0; for iu=Usim for is=Ssim for ir=Rsim it = it+1; fprintf('ITERATION LOOP 1 %8.1f\n',100*it/(length(Usim)*length(Ssim)*length(Rsim))) [w,v,x,resid, ... wpath(:,ir,is,iu),xpath(:,ir,is,iu),i1path(:,ir,is,iu),j2path(:,ir,is,iu), ... j3path(:,ir,is,iu),j4path(:,ir,is,iu),nloans(:,ir,is,iu),nrepay(:,ir,is,iu)] = ... simul(ir,is,iu,nw,nx,m,avail,rl,rs,gamma,eta,theta,mu,L,K,alpha,beta,bary,ymean,sigma,p,xmax,delta,nrep,nper,npast,Regname,Subname,Savename); figure plot(w,resid) figure plot(w,max(v,[],3)) end end end toc(ttt) %% OUTPUT 1 % Plot expected paths of variables for iu=Usim for is=Ssim % Plot expected path - wealth figure plot(0:npast+4,wpath(nper-4:nper+npast,:,is,iu),'LineWidth',4) title(['Per-Capita Wealth' Subname(iu) Savename(is)]) legend(Regname) legend('Location','best') legend boxoff ylim([0 4]) % Plot expected path - saving figure plot(0:npast+4,xpath(nper-4:nper+npast,:,is,iu),'LineWidth',4) title(['Per-Capita Saving' Subname(iu) Savename(is)]) legend(Regname) legend('Location','best') legend boxoff ylim([0 2]) % Plot expected path - delinquency rate figure plot(0:npast+4,1-i1path(nper-4:nper+npast,:,is,iu),'LineWidth',4) title(['Deliquency Rate' Subname(iu) Savename(is)]) legend(Regname) legend('Location','best') legend boxoff ylim([0 1]) % Plot expected path - default rate figure plot(0:npast+4,1-nrepay(nper-4:nper+npast,:,is,iu)./nloans(nper-4:nper+npast,:,is,iu),'LineWidth',4) title(['Default Rate' Subname(iu) Savename(is)]) legend(Regname) legend('Location','best') legend boxoff ylim([0 1]) % Plot expected path - loan uptake rate figure plot(0:npast+4,j2path(nper-4:nper+npast,:,is,iu),'LineWidth',4) title(['Loan Uptake Rate' Subname(iu) Savename(is)]) legend(Regname) legend('Location','best') legend boxoff ylim([0 1]) % Plot expected path - insurance uptake rate figure plot(0:npast+4,j3path(nper-4:nper+npast,:,is,iu),'LineWidth',4) title(['Insurance Uptake Rate' Subname(iu) Savename(is)]) legend(Regname) legend('Location','best') legend boxoff ylim([0 1]) % Plot expected path - hi tech uptake rate figure plot(0:npast+4,j4path(nper-4:nper+npast,:,is,iu),'LineWidth',4) title(['Hi Tech Uptake Rate' Subname(iu) Savename(is)]) legend(Regname) legend('Location','best') legend boxoff ylim([0 1]) end end %% OUTPUT 2 wpath = wpath(10:nper,:,:,:); xpath = xpath(10:nper,:,:,:); i1path = i1path(10:nper,:,:,:); j2path = j2path(10:nper,:,:,:); j3path = j3path(10:nper,:,:,:); j4path = j4path(10:nper,:,:,:); nloans = nloans(10:nper,:,:,:); nrepay = nrepay(10:nper,:,:,:); varss = zeros(12,Nr,Ns,Nu); varss( 1,:,:,:) = 100*mean(1-i1path); % Delinquency Rate varss( 2,:,:,:) = 100*mean(j2path); % Loan Uptake Rate varss( 3,:,:,:) = 100*mean(j3path); % Insurance Uptake Rate varss( 4,:,:,:) = 100*mean(j4path); % Hi-Tech Uptake Rate varss( 5,:,:,:) = 100*(1-sum(nrepay)./sum(nloans)); % Default Rate varss( 6,:,:,:) = 100*(sum(nrepay)*(1+rl)./sum(nloans)-1); % Lender RoR on Loans varss( 7,:,:,:) = 100*(mean(nrepay)*(1+rl)-mean(nloans))*L; % Lender Per-Capita Profit varss( 8,:,:,:) = 100*mean(xpath); % Per-Capita Savings varss( 9,:,:,:) = 100*mean(j4path.*(1-j3path)); % Hi-Tec Only Rate varss(10,:,:,:) = 100*mean(j3path.*(1-j4path)); % Insurance Only Rate varss(11,:,:,:) = 100*mean(j4path.*j3path); % Both Hi-Tec-Insurance Rate varss(12,:,:,:) = 100*mean((1-j4path).*(1-j3path)); % Neither Hi-Tec-Insurance Rate % Print steady-states values of variables fprintf('Discount Rate %8.1f\n',100*rho) fprintf('Loan Interest Rate %8.1f\n',100*rl) fprintf('Savings Interest Rate %8.1f\n',100*rs) fprintf('Hi-Tech Expected RoR %8.1f\n',100*R) fprintf('\n\n') fprintf('\n\n') for iu=Usim if iu==1 fprintf('\n\nUNSUBSIDIZED INSURANCE\n') fprintf('======================\n\n') else fprintf('\n\nSUBSIDIZED INSURANCE\n') fprintf('====================\n\n') end fprintf('RATES ------- Without Savings ------- -------- With Savings ---------\n') fprintf('Variable None Opt Mand Cont None Opt Mand Cont\n') fprintf('%-26s%8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f\n','Delinquency Rate ',varss( 1,:,:,iu)) fprintf('%-26s%8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f\n','Loan Uptake Rate ',varss( 2,:,:,iu)) fprintf('%-26s%8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f\n','Insurance Uptake Rate ',varss( 3,:,:,iu)) fprintf('%-26s%8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f\n','Hi-Tech Uptake Rate ',varss( 4,:,:,iu)) fprintf('%-26s%8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f\n','Default Rate ',varss( 5,:,:,iu)) fprintf('%-26s%8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f\n','Lender RoR on Loans ',varss( 6,:,:,iu)) fprintf('%-26s%8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f\n','Lender Per-Capita Profit ',varss( 7,:,:,iu)) fprintf('%-26s%8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f\n','Per-Capita Savings ',varss( 8,:,:,iu)) fprintf('%-26s%8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f\n','Hi-Tec Only Rate ',varss( 9,:,:,iu)) fprintf('%-26s%8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f\n','Insurance Only Rate ',varss(10,:,:,iu)) fprintf('%-26s%8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f\n','Both Hi-Tec-Insurance Rate ',varss(11,:,:,iu)) fprintf('%-26s%8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f\n','Neither Hi-Tec-Insurance Rate',varss(12,:,:,iu)) end % %% OUTPUT 3 % % % Interest Rate Sensitivity Analysis Ranges % Np = 21; % rmin = 0.0; % rmax = 0.4; % rlplot = nodeunif(Np,rmin,rmax); % profit = zeros(Np,Nr); % % iu = 1; % is = 1; % it = 0; % for ir=Rsim % for ip=1:Np % it = it+1; % fprintf('ITERATION LOOP 2 %8.1f\n',100*it/(Np*length(Rsim))) % profit(ip,ir) = ... % simulshort(ir,is,iu,nw,nx,m,avail,rlplot(ip),rs,gamma,eta,theta,mu,L,K,alpha,beta,bary,ymean,sigma,p,xmax,delta,nrep,nper,npast,Regname,Subname,Savename); % end % end % figure % plot(rlplot,profit,'LineWidth',4) % xlim([rmin rmax]) % title(['Per-Capita Profit vs. Interest Rate' Subname(iu) Savename(is)]) % legend(Regname) % legend('Location','best') % legend boxoff % xlabel('Interest Rate') % ylabel('Dollars') % % printfigures('Figure1',84,1,0)