*
* @RegExactDW
* Regression post-processor which computes the exact significance level for the
* Durbin-Watson statistic in an OLS regression.
*
* Revision Schedule
*  09/2007 Written by Tom Doan, Estima
*
procedure RegExactDW
local rect x
local symm m a mamzm
local integer i j
*
make(lastreg) x %regstart() %regend()
compute m=%identity(%nobs)-x*inv(tr(x)*x)*tr(x)
dim a(%nobs,%nobs)
ewise a(i,j)=%if(i==j,2.0,%if(i==j+1,-1.0,0.0))
compute a(1,1)=a(%nobs,%nobs)=1.0
compute mamzm=m*a*m-%durbin*m
compute %signif=%qformpdf(mamzm,0.0)
disp "Durbin-Watson Statistic" %durbin
disp "Exact Significance Level" %signif
end


