Equilibrium Interest Rate and Wage Rate
Household and Firm's Problem
Following our previous discussions, the household's borrowing constrained problem is: - specifically:

And the constraints are:



, where T is total time available
There are
households, each with a different
. For the firm, we have solved previously for the firm's optimal choices given w and r: Setting Up Parameters
Solve with three different discount rates, and different r and w. First, let's set up some parameters. The firm here has decreasing return to scale, let's ignore the issue of profit when looking for equilibrium.
% Parameters for the Household
b_bar_num = -1; % borrow up to 1 dollar
T = 1; % think about time as share of time in a year
% Parameters for the firm
beta_vec = [0.85 0.90 0.95];
% Vector of interest rates
R_vec = linspace(0.60, 2.50, 30);
% Vector of wage rates, 3 wage rates for now
W_vec = linspace(0.6, 2, 15);
% What we had from before to use fmincon
A = [-1,0,0;0,0,-1;0,-1,0;0,1,1];
b0 = [0,0.5,0.5]; % starting value to search for optimal choice
Household Labor Supply and Borrow/Save with different β and r ?
In the problem without labor supply I showed different excess supply of credit for each
household, we can do the same here for excess credit supply, but that is too much to show. I will just sum up the total across the households for both excress credit supply and total work hours: - Aggregate Household Excess Supply:

- Aggregate Household Labor Supply:

I store results in a matrix where each row correspond to an interest rate level and each color a wage rate.
% Various Matrixes to store optimal choices
wage_dim_len = length(W_vec);
b_opti_mat = zeros(rows, cols);
worKOpti_mat = zeros(rows, cols);
leisure_opti_mat = zeros(rows, cols);
c1_opti_mat = zeros(rows, cols);
c2_opti_mat = zeros(rows, cols);
% Solving for optimal choices as we change Z2
% Initialize aggregate household statistics given r and w
for h=1:1:length(beta_vec)
U_neg = @(x) -1*(log(z1 + W_vec(j)*x(2) - x(1)) + psi*log(x(3)) + beta_vec(h)*log(z2 + x(1)*(R_vec(i))));
options = optimoptions('FMINCON','Display','off');
[x_opti,U_at_x_opti] = fmincon(U_neg, b0, A, q, [], [], [], [], [], options);
% Sum up at current r and w for all households
agg_b_supply_at_w_r = agg_b_supply_at_w_r + x_opti(1);
agg_work_at_w_r = agg_work_at_w_r + x_opti(2);
agg_leisure_at_w_r = agg_leisure_at_w_r + x_opti(3);
agg_c1_at_w_r = agg_c1_at_w_r + z1 + W_vec(j)*x_opti(2) - x_opti(1);
agg_c2_at_w_r = agg_c2_at_w_r + z2 + x_opti(1)*(R_vec(i));
% Store aggregate Household statistics
b_opti_mat(i, j) = agg_b_supply_at_w_r;
worKOpti_mat(i, j) = agg_work_at_w_r;
leisure_opti_mat(i, j) = agg_leisure_at_w_r;
c1_opti_mat(i, j) = agg_c1_at_w_r;
c2_opti_mat(i, j) = agg_c2_at_w_r;
Firm's Demand for Capital and Labor
The firm's problem loops over r and w, do not need to loop over
. We get here: - Firm Demand For Capital:

- Firm Demand For Labor:

% Various Matrixes to store optimal choices
K_demand_mat = zeros(rows, cols);
L_demand_mat = zeros(rows, cols);
% We solved before optimal choices
% Matrix Form of linear system, same as before
B = [log(r/(p*Aproductivity*alpha)); log(w/(p*Aproductivity*beta))];
A = [(alpha-1), beta;alpha, beta-1];
% Solve linear equations, and then exponentiate, same as before
% We can use the simplify command to simplify this solution, get rid of exp and log:
lin_solu = simplify(exp(linsolve(A, B)));
KOpti = lin_solu(1)
KOpti =

LOpti = lin_solu(2)
LOpti =

% Solving for optimal choices as we change Z2
K_demand_mat(i,j) = subs(KOpti,{r,w},{R_vec(i), W_vec(j)});
L_demand_mat(i,j) = subs(LOpti,{r,w},{R_vec(i), W_vec(j)});
Demand and Supply for Capital
We can graph out from the firm and household problem demand and supply for capital
% Household b (some borrow some save added up)
chart = plot(R_vec, b_opti_mat);
set(chart(m),'Color',clr(m,:))
plot(R_vec,ones(size(R_vec)) * 0, 'k-.');
xlim([min(R_vec) max(R_vec)]);
title('Household Net B Supply')
ylabel({['Aggregate Household Net Saving Borrowing'], ['(over 3 household \beta types)']})
chart = plot(R_vec, -K_demand_mat);
set(chart(m),'Color',clr(m,:))
plot(R_vec,ones(size(R_vec)) * 0, 'k-.');
xlim([min(R_vec) max(R_vec)]);
title('-1*(Firm K Demand)')
ylabel('Firm Demand for Capital (Decreasing Return to Scale)')
legend2plot = [1 round(numel(chart)/2) numel(chart)];
legendCell = cellstr(num2str(W_vec', 'wage=%3.2f'));
legend(chart(legend2plot), legendCell(legend2plot), 'Location','southeast');
Demand and Supply for Labor Demand and Supply
We now generate the same graphs for Labor
% Household b (some borrow some save added up)
chart = plot(R_vec, worKOpti_mat);
set(chart(m),'Color',clr(m,:))
xlim([min(R_vec) max(R_vec)]);
title('Household Work Supply')
ylabel({['Aggregate Household Work Hours'], ['(over 3 household \beta types)']})
chart = plot(R_vec, L_demand_mat);
set(chart(m),'Color',clr(m,:))
xlim([min(R_vec) max(R_vec)]);
ylabel('Firm Demand for Labor (Decreasing Return to Scale)')
legendCell = cellstr(num2str(W_vec', 'wage=%3.2f'));
legend(legendCell, 'Location','northeast');
Excess Demand for Capital and Labor
We can sum up the firm and household sides to try to find the r and w where demand and supply are equalized.
- Economy-wide excess supply of Credit:

- Economy-wide excess supply of Credit:

% Household and Firm Excess Credit Supply, aggregated together
chart = plot(R_vec, b_opti_mat-K_demand_mat);
set(chart(m),'Color',clr(m,:))
plot(R_vec,ones(size(R_vec)) * 0, 'k-.');
xlim([min(R_vec) max(R_vec)]);
title('HH + Firm Excess Credit Supply')
ylabel({['Economy Wide Excess Supply for Credit'], ['(over 3 household \beta types + Firm)']})
chart = plot(R_vec, worKOpti_mat - L_demand_mat);
set(chart(m),'Color',clr(m,:))
plot(R_vec,ones(size(R_vec)) * 0, 'k-.');
xlim([min(R_vec) max(R_vec)]);
title('HH + Firm Excess Labor Supply')
ylabel({['Economy Wide Excess Supply for Labor'], ['(over 3 household \beta types + Firm)']})
legendCell = cellstr(num2str(W_vec', 'wage=%3.2f'));
legend(legendCell, 'Location','southeast');
w and r Equilibrium
Now let's do a final sum we want to find where both aggregate labor and capital clear.
% Aggregate Excess Supplies
excess_credit_supply = abs(b_opti_mat - K_demand_mat);
excess_labor_supply = abs(worKOpti_mat - L_demand_mat);
We need to take the absolute values of the two differences above and sum them up. The equilibrium is approximately where the sum of the two matrixes is the closest to 0.
DS_KL_DIFF = excess_credit_supply + excess_labor_supply;
[DS_KL_diff_EQUI_val, EQUI_IDX] = min(min(DS_KL_DIFF));
[r_idx, w_idx]=find(DS_KL_DIFF==DS_KL_diff_EQUI_val);
equi_price = table(equi_r, equi_w);
disp(equi_price);
equi_r equi_w
______ ______
2.0414 0.7
% Both should be zero (if the scale of L and K are very different this would not work well)
% We can sum up the two and look for r and w closest to zero
chart = plot(R_vec, DS_KL_DIFF);
set(chart(m),'Color',clr(m,:))
xlim([min(R_vec) max(R_vec)]);
title('abs(Excess K) + abs(Excess L)')
ylabel({['Economy Wide Excess Supply for Credit'], ['(over 3 household \beta types + Firm)']})
legendCell = cellstr(num2str(W_vec', 'wage=%3.2f'));
legend(legendCell, 'Location','northeast');
mesh(R_vec, W_vec, DS_KL_DIFF');
title('abs(Excess K) + abs(Excess L)')