%TVCCI_DM_TEST produces the denHaan-Marcet (RES, 1994) accuracy test in an economy with an individual time-varying collateral constraint. %For a description of the underlying economic model, see ``Individual Versus Aggregate Collateral Constraints and the Overborrowing Syndrome,'' by Martin Uribe, April 2006. %(c) Martin Uribe, May 1, 2006 function [dmL,dmH, J, cvL, cvH]= tvcci_dm_test(zL, zH, DL, DH, aL, aH, a1L, a1H, n, RSTAR, SIG, OMEGA, BETTA1, ALFA, PAIZ, KAPA, Kss); J=5000; %number of simulations of the model dmH = 0; %Percentage of the J simulations producing a value of the denHaan-Marcet statistic smaller than the critical value at which the chi-square cumulative distribution reaches 5 percent dmL = 0; %Percentage of the J simulations producing a value of the denHaan-Marcet statistic larger than the critical value at which the chi-square cumulative distribution reaches 95 percent cvH=33.92; %prob(x>33.92)=0.05 chi^2 (22 degrees of freedom). The degrees of freedom are given by n1*q2, where q1=number of Euler equarions in the test, and q2=number of instruments. In this example, q1=2 and q2=11. cvL=12.34; ;%prob(x<12.34)=0.05 chi^2 (22 degrees of freedom) j=0; while jcvH); %prob(x>19.67)=0.05 chi^2 11 df dmL = dmL + (dm