%TVCC.M %Compute equilibrium dynamics in an economy with an aggregate collateral constraint studied in ``Individual versus Aggregate Coolateral Constraints and the Overborrowing Syndrome,'' by Martin Uribe. The aggregate collateral constraint is of the form a_{t+1} <= kappa q_t k^*, where A_{t+1} denotes aggregate external debt due in t+1, q_t is the price of land, k^* is the fixed aggregae supply of land, and kappa is a parameter. Rents from financial rationing are assumed to accrue to domestic households. Equilibrium is computed using the Chebyshev parameterized expectations method. %(c) Martin Uribe, April 27, 2006. clc clear all format compact %Deep parameters and steady-state values [RSTAR, SIG, OMEGA, BETTA1, ALFA, MU, z, PAIZ, KAPA, Kss, QQss, Css, Hss, LAss, Ass, Yss, BETTAss] = tvcc_ss; %Values of productivity shock zL = z(1); zH = z(2); %Debt limits DH = 7.14; DL = -6; m = 1000; %number of grid points for debt n = 30; %number of parameters in Chebyshev parameterization a = chebygrid(DL,DH,m); %debt grid X = chebyreg(m,n); %regressors D = inv(X'*X); %Regression Parameters Low state aL = zeros(n,1); aL(1) = log(LAss/RSTAR); a1L = zeros(n,1); a1L(1) = log(1); %Regression Parameters High state aH = aL; a1H = a1L; dist=1; %distance lambda = 0.01; %smoothing parameter while dist>1e-12 %Parameterizing the object U_c(c_t,h_t)/R_t laL_o_rL = exp(X*aL) ; laH_o_rH = exp(X*aH); %Parameterizing the price of land q_t qL = exp(X*a1L) ; qH = exp(X*a1H); %Obtain other endogenous variables [rL, rH, laL, laH, hL, hH, yL, yH, cL, cH, apL, apH, bettaL, bettaH] = tvcc_variables(laL_o_rL, laH_o_rH, qL, qH, a, DL, DH); %Parameterizing U_c(c_t+1,h_t+1)/R_t+1 WL = chebyreg2(apL,DL,DH,n); WH = chebyreg2(apH,DL,DH,n); laLL_o_rLL = exp(WL*aL); laLH_o_rLH = exp(WL*aH); laHL_o_rHL = exp(WH*aL); laHH_o_rHH = exp(WH*aH); %Parameterizing q_t+1 qLL = exp(WL*a1L); qLH = exp(WL*a1H); qHL = exp(WH*a1L); qHH = exp(WH*a1H); %Obtaining future vaules of other endogenous variables [rLL, rLH, laLL, laLH, hLL, hLH, yLL, yLH, cLL, cLH, apLL, apLH, bettaLL, bettaLH] = tvcc_variables(laLL_o_rLL, laLH_o_rLH, qLL, qLH, apL, DL, DH); [rHL, rHH, laHL, laHH, hHL, hHH, yHL, yHH, cHL, cHH, apHL, apHH, bettaHL, bettaHH] = tvcc_variables(laHL_o_rHL, laHH_o_rHH, qHL, qHH, apH, DL, DH); %Expected value of U_c(c_t+1,h_t+1) ElapL = [laLL laLH] * PAIZ(1,:)'; ElapH = [laHL laHH] * PAIZ(2,:)'; %Compute the RHS of the bond Euler equation rhsL = log (bettaL .* ElapL); rhsH = log (bettaH .* ElapH); %Compute the RHS of the price-of-land Euler equation xLL = laLL .* (qLL + exp(zL) * ALFA * (hLL/Kss).^(1-ALFA) ); xLH = laLH .* (qLH + exp(zH) * ALFA * (hLH/Kss).^(1-ALFA) ); xHL = laHL .* (qHL + exp(zL) * ALFA * (hHL/Kss).^(1-ALFA) ); xHH = laHH .* (qHH + exp(zH) * ALFA * (hHH/Kss).^(1-ALFA) ); ExpL = [xLL xLH] * PAIZ(1,:)'; ExpH = [xHL xHH] * PAIZ(2,:)'; rhs1L = log(bettaL .* ExpL ./ laL); rhs1H = log (bettaH .* ExpH ./ laH); %Store old value of parameter vector aLold = aL; aHold = aH; aold = [aLold; aHold]; a1Lold = a1L; a1Hold = a1H; a1old = [a1Lold; a1Hold]; Aold = [aold; a1old]; %Compute new parameter vectors by OLS aLnew = D*X'*rhsL; aHnew = D*X'*rhsH; anew = [aLnew;aHnew]; a1Lnew = D*X'*rhs1L; a1Hnew = D*X'*rhs1H; a1new = [a1Lnew;a1Hnew]; Anew = [anew; a1new]; %Compute distance between old and new parameter dist_old = dist; dist = max(abs(Anew-Aold)); %Reset smoothing parameter if dist