% share.m % Pareto optimal allocations in static setting with power certainty equivalent % Details: two agents, potentially diff risk aversion parameters % Notation: ci^(1-alphai)/(1-alphai) format compact clear all clf maxit = 20; eps = 1.e-10; FontSize = 12; disp('Allocations for 2-agent risk-sharing problem') disp('********************************************') disp(' ') % parameters alpha1 = 1.0; alpha2 = 2.0; %lambda = 1; % Output and probs y = 2*[0.8 0.9 1 1.1 1.2]'; y = 2*[0.5 0.75 1 1.25 1.5]'; p = [1 1 1 1 1]'/5; ybar = sum(p.*y); % Initializations theta1 = 1; theta2 = 1; c = y/2; f = theta1*c.^(-alpha1) - theta2*(y-c).^(-alpha2); % Newton iterations for it = 1:maxit fp = -alpha1*theta1*c.^(-alpha1-1) - alpha2*theta2*(y-c).^(-alpha2-1); % fp2 = (theta1*(c+eps).^(-alpha1) - theta2*(y-c-eps).^(-alpha2) - f)./eps; % [c f fp] cnext = c - f./fp; fnext = theta1*cnext.^(-alpha1) - theta2*(y-cnext).^(-alpha2); fnorm = max(abs(f-fnext)); cnorm = max(abs(c-cnext)); if fnorm < eps, break, end f = fnext; c = cnext; end disp('Converged on iteration') it disp('Norms should be zero') [fnorm cnorm] c1 = c; c2 = y - c1; figure(1) plot(c1,c2,'*') %axis equal axis([0 2 0 2]) xlabel('Consumption of Agent 1','FontSize',FontSize) ylabel('Consumption of Agent 2','FontSize',FontSize) hold on % log-linear approximation c1grid = [0.1:0.05:1.9]'; c2grid = c1grid.^(alpha1/alpha2); plot(c1grid,c2grid,'-') plot(c1grid,c1grid,':') print -deps riskshare1fig1.eps % Allocation rule (log-lin approx) ygrid = [1:0.05:3]'; c1grid = (ygrid/2).^(2*alpha2/(alpha1+alpha2)); figure(2) plot(ygrid,c1grid,'-') hold on plot(y,c1,'*') plot(y,y/2,':') ylabel('Consumption of Agent 1','FontSize',FontSize) xlabel('Aggregate Endowment','FontSize',FontSize) print -deps riskshare1fig2.eps return