Solving capital constraint and optimal labor choice using numerical method - fzero
Function takes important model parameters as inputs and evaluates constrained k and corresponding optimal l, given phi using numerical method - fzero.
Back to full code page https://kritikhanna.github.io/BKS-modified/
Function Inputs : One combination of Asset and entrepreneurial productivity, relevant model parameters required to compute the constraint on capital and labor based on the degree of contract enforceability.
Function Outputs : constrained k and l (scalers)
Contents
function [k,l] = conkl_numerical(varargin)
close all; profile off; profile on; if (~isempty(varargin)) [fl_a,fl_z,fl_r,fl_w,fl_alpha,fl_theta,fl_kappa,fl_delta,fl_phi,fl_R] = varargin{:}; bl_display_param = true; else fl_a = 50; fl_z = 1; fl_r = 0.0467; fl_w = 1.0667; fl_alpha = 0.36; fl_theta = 0.79-fl_alpha; fl_kappa = 0; fl_delta = 0.06; fl_phi = 0.1; fl_R = fl_r + fl_delta; bl_display_param = true; end %s = (fl_w/(fl_theta*fl_z*kbar^(fl_alpha)))^(1/(fl_theta-1)); %lval= z*x(1)^alpha*s^theta-w*s; %lval=kbar^fl_alpha*fl_z*((fl_w/(kbar^fl_alpha*fl_theta*fl_z))^(1/(fl_theta - 1)))^fl_theta - fl_w*(fl_w/(kbar^fl_alpha*fl_theta*fl_z))^(1/(fl_theta - 1));
Capital renting constraint condition
c = @(kbar)[(1+fl_r)*fl_kappa-fl_z*kbar^fl_alpha*(fl_w/(fl_theta*fl_z*kbar^(fl_alpha)))^(1/(fl_theta-1))^fl_theta;(1-fl_phi)*(kbar^fl_alpha*fl_z*((fl_w/(kbar^fl_alpha*fl_theta*fl_z))^(1/(fl_theta - 1)))^fl_theta - fl_w*(fl_w/(kbar^fl_alpha*fl_theta*fl_z))^(1/(fl_theta - 1))+(1-fl_delta)*kbar)-kbar^fl_alpha*fl_z*((fl_w/(kbar^fl_alpha*fl_theta*fl_z))^(1/(fl_theta - 1)))^fl_theta - fl_w*(fl_w/(kbar^fl_alpha*fl_theta*fl_z))^(1/(fl_theta - 1))+fl_R*kbar+(1+fl_r)*fl_kappa-(1+fl_r)*fl_a]; k = fsolve(c,2); % Solving for constraint k l = (fl_w/(fl_theta*fl_z*k^(fl_alpha)))^(1/(fl_theta-1)); % Value of corresponding optimal l if (bl_display_param == true) disp(['k= ' ,num2str(k)]); % Display contrained k disp(['l= ' ,num2str(l)]); % Display optimal l corresponding to constrained k profile off; profile viewer; end
Warning: Trust-region-dogleg algorithm of FSOLVE cannot handle non-square systems; using Levenberg-Marquardt algorithm instead. No solution found. fsolve stopped because the last step was ineffective. However, the vector of function values is not near zero, as measured by the default value of the function tolerance. k= 60.8724 l= 2.7212
end