DW: Double;
The DW property returns Durbin-Watson statistics.
These statistic shows whether there is any time correlation for the system errors.
To execute the example, add a link to the Stat system assembly.
Sub UserProc;
Var
LinearR: SmLinearRegress;
can, fr: Array[9] Of Double;
res, i: Integer;
Con: IIntercept;
ss: ISummaryStatistics;
Begin
LinearR := New SmLinearRegress.Create;
For i := 0 To 8 Do
can[i] := 1230 + i * 302;
fr[i] := 579.5 + i * 9.4;
End For;
// Set model parameters
LinearR.Explained.Value := can;
LinearR.Explanatories.Add.Value := fr;
Con := LinearR.ModelCoefficients.Intercept;
con.Mode := InterceptMode.ManualEstimate;
con.Estimate := 35.7;
// Run calculation
res := LinearR.Execute;
ss := LinearR.SummaryStatistics;
Debug.Write("Durbin-Watson statistic: ");
Debug.WriteLine(ss.DW);
Debug.Write("Probability for lower bound of the Durbin-Watson statistics range: ");
Debug.WriteLine(ss.DWLowerBound);
Debug.Write("Probability for upper bound of the Durbin-Watson statistics range: ");
Debug.WriteLine(ss.DWUpperBound);
End Sub UserProc;
After executing the example the console window displays summary statistics:
Durbin-Watson statistics value.
Probability for lower bound of the Durbin-Watson statistics range.
Probability for upper bound of the Durbin-Watson statistics range.
See also: