DurbinWatsonStats(N: Integer; K: Integer; Alpha: Double; Var dL: Double; Var dU: Double);
N. Number of observations.
K. Number of model variables including constant.
Alpha. Significance level. It may take values 1, 2.5 and 5.
dL. Lower bound of the Durbin-Watson statistics.
dU. Upper bound of the Durbin-Watson statistics.
The DurbinWatsonStats method returns approximated values of Durbin-Watson statistics range bounds taken from tables.
After executing the method the dL and dU parameters take values of the lower and upper bounds of the Durbin-Watson statistics range.
Interpretation of results:
If DW ≤ 2, positive autocorrelation is checked:
If du < DW, zero hypothesis is not rejected, there is no autocorrelation.
If dl < DW and DW < du, there is uncertainty.
If 0 < DW and DW < dl, zero hypothesis is rejected, there is positive residuals autocorrelation.
If DW > 2, negative autocorrelation is checked, it is required to recalculate the statistics DW = 4 - DW and check as in the first case.
Add a link to the Stat system assembly.
Sub UserProc;
Var
Stat: Statistics;
N, K: Integer;
Alpha, dU, dL, DW: Double;
Begin
Stat := New Statistics.Create;
// Set number of observations
N := 20;
// Set number of model variables
K := 5;
// Set significance level
Alpha := 5;
// Calculate bounds of the Durbin-Watson statistics range
Stat.DurbinWatsonStats(N, K, Alpha, dL, dU);
// Output lower and upper range bounds
Debug.WriteLine("Lower range bound: " + dL.ToString);
Debug.WriteLine("Upper range bound: " + dU.ToString);
//Check hypothesis
DW := 1.98;
Debug.WriteLine("Check hypothesis:");
If (DW <= 2) Then
If (dU < DW) Then
Debug.WriteLine("Zero hypothesis is accepted, " +
"correlation coefficient p = 0, no residual autocorrelation" );
End If;
If ((dL < DW) And (DW < dU)) Then
Debug.WriteLine("Uncertainty");
End If;
If ((0 < DW) And (DW < dL)) Then
Debug.WriteLine("Zero hypothesis is rejected, " +
"autocorrelation coefficient p <> 0, there is residual autocorrelation" );
End If;
Else
DW := 4 - DW;
If (dU < DW) Then
Debug.WriteLine("Zero hypothesis is accepted, " +
"correlation coefficient p = 0, no residual autocorrelation" );
End If;
If ((dL < DW) And (DW < dU)) Then
Debug.WriteLine("Uncertainty");
End If;
If ((0 < DW) And (DW < dL)) Then
Debug.WriteLine("Zero hypothesis is rejected," +
"autocorrelation coefficient p <> 0, there is negative residual autocorrelation" );
End If;
End If;
End Sub UserProc;
After executing the example the console window displays lower and upper bounds of the Durbin-Watson statistics range, the hypothesis about residuals autocorrelation is checked.
See also: