%CCRC_VARIABLES.M function [rL, rH, laH, laL, hL, hH, yL, yH, cL, cH, apL, apH, bettaL, bettaH] = ccrc_variables(rcL, rcH,a, DL, DH); %[rL, rH, laH, laL, hL, hH, yL, yH, cL, cH, apL, apH, bettaL, bettaH] = ccrc_variables(rcL, rcH,a, DL, DH); Given the stock of debt and the ratios rL*cL and rH*cH, this program returns the equilibrium values of hours worked (hL and hH), output (yL and yH), the marginal utility of wealth (laL and laH), consumption (cL and cH), and next-period debt (apL and apH), and an indicator variable (ccvL and ccvH) indicating the states in which the collateral constraint binds. The subscripts L and H refer to low and high (or 1 and 2) states of technology. %Deep parameters and steady-state values [RSTAR, SIG, OMEGA, BETTA1, ALFA, MU, z, PAIZ, KAPA, Kss, QQss, Css, Hss, LAss, Ass, Yss, BETTAss] = ccrc_ss; %Two possible states of technology zL = z(1); zH = z(2); m = length(rcL); %Interest rate under the conjecture of debt limit not binding rL = ones(m,1)*RSTAR; rH = ones(m,1)*RSTAR; %Consumption cL = rcL./rL; cH = rcH ./rH; %Hous hL = ( (1-ALFA) * exp(zL) * Kss^(ALFA) ) .^(1/(OMEGA+ALFA-1)); hH = ( (1-ALFA) * exp(zH) * Kss^(ALFA) ) .^(1/(OMEGA+ALFA-1)); %Output yL = exp(zL) * Kss^ALFA * hL.^(1-ALFA); yH = exp(zH) * Kss^ALFA * hH.^(1-ALFA); %Next period's debt apL = RSTAR .* (a + cL - yL); apH = RSTAR .* (a + cH - yH); %Indicate periods in which the debt limit is binding ccvL = find(apL>DH); ccvH = find(apH>DH); %Impose limits on debt apL = max(apL,DL); apL = min(apL,DH); apH = max(apH,DL); apH = min(apH,DH); %adjust interest rate rL(ccvL) = (apL(ccvL)-rcL(ccvL)) ./ (a(ccvL)-yL); rH(ccvH) = (apH(ccvH)-rcH(ccvH)) ./ (a(ccvH)-yH); %adjust consumption cL = apL./rL - a+yL; cH = apH./rH - a+yH; %Discount factor bettaL = (1+cL-hL.^OMEGA/OMEGA).^(-BETTA1); bettaH = (1+cH-hH.^OMEGA/OMEGA).^(-BETTA1); %Marginal utility of consumption laL = (cL-hL.^OMEGA/OMEGA).^(-SIG); laH = (cH-hH.^OMEGA/OMEGA).^(-SIG);