OPTIONS CRT; name bde 'Example of Brown-Durbin-Evans CUSUM Tests' ; ? ? example of calculating/plotting Brown-Durbin-Evans ? CUSUM and CUSUM2 tests ? for a regression of time squared on time and a constant ? TSP 4.2A (Sept 1992) ? Author: Clint Cummins ? SMPL 1,10; TREND T; T2=T*T; REGOPT RECRES; ? turn on calculation of recursive residuals OLSQ T2 C T; ? ? CUSUM section is adapted from "Analysing Economic Data by TSP" ? by Prof. Kanemi Ban and Prof. Hajime Wago, University of Tokyo Press ? (in Japanese) ? SET K1 = @NCOEF+1; ? number of RHS variables plus 1 ? (start of nonzero recursive residuals) SET SMPL2 = @NOB; ? for SMPL 1,n; SET NDF = @NOB - @NCOEF; SMPL K1,SMPL2; MSQUARE @RECRES RRSUM; CUSUM = @RECRES/SQRT(RRSUM/(@NOB-1)); CUSUMSQ = @RECRES*@RECRES/RRSUM; SET K2 = K1+1; SMPL K2,SMPL2; CUSUM = CUSUM(-1) + CUSUM; CUSUMSQ = CUSUMSQ(-1) + CUSUMSQ; ? ? construct bounds for test using 5% significance level ? SMPL K1,SMPL2; TREND TK; ? means (t-K) WU = .948*SQRT(NDF) + 2*.948*TK/SQRT(NDF); WL = -WU; WWU = .32894 + TK/NDF; WWL = -.32894 + TK/NDF; TITLE 'CUSUM Plot'; PLOT(ORIGIN) WU U CUSUM * WL L; TITLE 'CUSUMSQ Plot'; PLOT(MAX=1,MIN=0) WWU U CUSUMSQ * WWL L; END;