******************************************************************** PROGRAM for "Strengthing the Case for the Yield Curve as a Predictor of U.S. Recessions," by Michael J. Dueker which appeared in the March/April 1997 REVIEW, pp. 41-51. ******************************************************************** This is an EViews program that generates the results for the first two tables in the paper (simple probits with and w/o lagged dependent variables). ******************************************************************** create m 59.1 95.5 read(o) usrec2.dat 24 genr SLP = 100*(log(1+(bond/100)) - log(1+(bill/100))) genr SPD = 100*(log(1+(cpsix/100)) - log(1+(billsix/100))) genr STK = 100*(log(spindx/spindx(-1))) genr M = 100*(log(mone/cpi)-log(mone(-1)/cpi(-1))) genr LD = D(lead) equation REC3.probit recess c recess(-3) equation REC6.probit recess c recess(-6) equation REC9.probit recess c recess(-9) equation REC12.probit recess c recess(-12) equation rec.probit recess c genr prREC = @CNORM(c(1)) 'SLOPE equation SLP3R.probit recess c recess(-3) SLP(-3) equation SLP6R.probit recess c recess(-6) SLP(-6) equation SLP9R.probit recess c recess(-9) SLP(-9) equation SLP12R.probit recess c recess(-12) SLP(-12) equation SLP3.probit recess c SLP(-3) equation SLP6.probit recess c SLP(-6) equation SLP9.probit recess c SLP(-9) equation SLP12.probit recess c SLP(-12) 'SPREAD equation SPD3R.probit recess c recess(-3) SPD(-3) equation SPD6R.probit recess c recess(-6) SPD(-6) equation SPD9R.probit recess c recess(-9) SPD(-9) equation SPD12R.probit recess c recess(-12) SPD(-12) equation SPD3.probit recess c SPD(-3) equation SPD6.probit recess c SPD(-6) equation SPD9.probit recess c SPD(-9) equation SPD12.probit recess c SPD(-12) 'S&P 500 equation STK3R.probit recess c recess(-3) STK(-3) equation STK6R.probit recess c recess(-6) STK(-6) equation STK9R.probit recess c recess(-9) STK(-9) equation STK12R.probit recess c recess(-12) STK(-12) equation STK3.probit recess c STK(-3) equation STK6.probit recess c STK(-6) equation STK9.probit recess c STK(-9) equation STK12.probit recess c STK(-12) 'MONEY equation M3R.probit recess c recess(-3) M(-3) equation M6R.probit recess c recess(-6) M(-6) equation M9R.probit recess c recess(-9) M(-9) equation M12R.probit recess c recess(-12) M(-12) equation M3.probit recess c M(-3) equation M6.probit recess c M(-6) equation M9.probit recess c M(-9) equation M12.probit recess c M(-12) 'LEAD equation LD3R.probit recess c recess(-3) LD(-3) equation LD6R.probit recess c recess(-6) LD(-6) equation LD9R.probit recess c recess(-9) LD(-9) equation LD12R.probit recess c recess(-12) LD(-12) equation LD3.probit recess c LD(-3) equation LD6.probit recess c LD(-6) equation LD9.probit recess c LD(-9) equation LD12.probit recess c LD(-12) ************************************************************************** The program below is ESTRELLA.GA7. It was used to estimate the probits with Markov switching. This is a GAUSS program. For each run the PERAHD variable must be set to the appropriate value (for example PERAHD=12 for 12 month ahead forecast). Also, the independent variable must be chosen and set (XX=lead1 for example). If the convergence is a problem try some different starting values for "beta" and restart the program. ************************************************************************** new; disable; #lineson; library optmum; #include optmum.ext; optset; output file = c:\gauss\work\estrella\lead12.o07 reset; ?"PERAHD=12 for slope-- Markov switching model with lagged dependent"; load dat[437,24]=c:\gauss\work\estrella\usrec.dat; @date recess bill bond cp6 bill6 djia nyse sp500 m0 m1 m2 m3 cpi napmc vp cord hi mord cexp twd lead xli xli2 @ t= 437; @PERAHD is periods (months) to forecast ahead@ PERAHD = 12; k= PERAHD; slope1= 100*ln((1+dat[2:t-k,4]/100)./(1+dat[2:t-k,3]/100)); spread1= 100*ln((1+dat[2:t-k,5]/100)./(1+dat[2:t-k,6]/100)); stock1 = 100*ln(dat[2:t-k,9]./dat[1:t-k-1,9]); money1 = 100*(ln(dat[2:t-k,11]./dat[2:t-k,14]) -ln(dat[1:t-k-1,11]./dat[1:t-k-1,14])); lead1 = dat[2:t-k,22]-dat[1:t-k-1,22]; DV= dat[2+k:t,2]; DV= DV~(1-DV); beta = 0.93157077| 0.956221| -.327513| -.4140028| -.76| -0.19939088| 0.25764115| -.72; XX2 = lead1; XX = ones(rows(XX2),1)~XX2~dat[2:t-k,2]; XX2= XX; beta~TRANS(TRAN_INV(beta)); {xout,f2,g2,retcode}= optmum(&q1max,TRAN_INV(beta)); xout; PRM_FNL=TRANS(xout); xout~prm_fnl; "likelihood value is ";; -f2; hout=inv(hessp(&q1max,xout)); grdn_fnl=gradfd(&TRANS,xout); @grdn_fnl = eye(rows(xout));@ Hsn_fnl=grdn_fnl*hout*grdn_fnl'; SD_fnl =sqrt(diag(Hsn_fnl)); "==FINAL OUTPUT========================================================"; "likelihood value is ";; -f2; "Estimated parameters are:"; prm_fnl'; "var-cov matrix is:"; Hsn_fnl; "Standard errors of parameters are:"; sd_fnl; "==============================================================="; PROC (1) = Q1MAX(param2); local param,p,q,fill,sig,c,beta,tp,tpl,ps,psl,psy,llf,k,j,beta1,beta2,l; EXTERNAL PROC TRANS; param= TRANS(param2); p= param[1]; q= param[2]; tp = (p~(1-q))|((1-p)~q); l= PERAHD; c= -1E299|0|1E299; sig= 1|1; @ sig[2]= param[rows(param)];@ beta= (param[3:rows(param)-1]); beta= param[3:5]~param[6:rows(param)]; k= (1-q)/(2-p-q)*sig[1]; k=k+(1-p)/(2-p-q)*sig[2]; ps= zeros(rows(XX),1); psy= zeros(rows(XX),1); psl= psy; llf= zeros(rows(XX),1); ps[1,1]= (1-q)/(2-p-q); @ ps[1,2]= (1-p)/(2-p-q); @ k=1; do while k <= rows(XX); tpl = eye(2); if k-l > 0; j=1; do while j <= l; tpl= tp*tpl; j=j+1; endo; fill= tpl*(psy[k-l]|(1-psy[k-l])); psl[k,1]=fill[1]; else; psl[k,1]=ps[k,1]; endif; j=1; do while j <= 2; @MAKE THE LLF DEPEND ON A FORECAST of PS based on PERAHD @ llf[k]= llf[k]+ DV[k,j]*ln(psl[k,1]*(CDFN(XX[k,.]*beta[.,1]+c[j+1]) -CDFN(XX[k,.]*beta[.,1]+c[j]))+ (1-psl[k,1])*(CDFN((XX[k,.]*beta[.,2]+c[j+1])/sig[2]) -CDFN((XX[k,.]*beta[.,2]+c[j])/sig[2]))); psy[k,1]= psy[k,1]+ DV[k,j]*ps[k,1]*(CDFN(XX[k,.]*beta[.,1]+c[j+1])-CDFN(XX[k,.]*beta[.,1]+c[j]))/ ( ps[k,1]*(CDFN(XX[k,.]*beta[.,1]+c[j+1])-CDFN(XX[k,.]*beta[.,1]+c[j]))+ (1-ps[k,1])* (CDFN((XX[k,.]*beta[.,2]+c[j+1])/sig[2]) -CDFN((XX[k,.]*beta[.,2]+c[j])/sig[2]))); j=j+1; endo; if k <= rows(XX)-1; ps[k+1,1] = p*psy[k,1]+(1-q)*(1-psy[k,1]); endif; /* DV[k,1]~psy[k,1]~(psl[k,1]*(CDFN(XX[k,.]*beta[.,1]+c[2]) -CDFN(XX[k,.]*beta[.,1]+c[1]))+ (1-psl[k,1])*(CDFN((XX[k,.]*beta[.,2]+c[2])/sig[2]) -CDFN((XX[k,.]*beta[.,2]+c[1])/sig[2]))); */ k=k+1; endo; retp(-sumc(llf)); endp; PROC (1) = TRANS(param); local m,m2,u,u2,para; m= 0; m2=1.1; u2=40; u=.99999; para=param; para[1:2]= m+(u-m)./(1+exp(param[1:2])); @ para[rows(para)]= m2+(u2-m2)./(1+exp(param[rows(param)])); @ retp(para); endp; PROC (1) = TRAN_INV(param); local para,m,m2,u2,u; m=0; m2=1.1; u2=40; u=.99999; para=param; para[1:2]= 1*ln((u-param[1:2])./(param[1:2]-m)); @ para[rows(para)]= 1*ln((u2-param[rows(param)])/(param[rows(param)]-m2));@ /* para[4] = sqrt(param[4]-m); para[5] = sqrt(param[5]-m-param[4]); para[6] = sqrt(param[6]-m-param[5]); para[7] = sqrt(param[7]-m-param[6]); para[8] = sqrt(param[8]-m-param[7]); */ retp(para); endp; end;