dwstat#

Purpose#

Computes the Durbin-Watson statistic.

Format#

dw = DWstat(resid)#
Parameters:

resid (Tx1 vector) – Residuals.

Returns:

dw (Scalar) – Durbin-Watson statistic.

Examples#

// Generate random residuals
rndseed 8098;
resid = rndn(150, 1);

// Calculate DW statistic
dw = DWstat(resid);

The code above computes the following statistic:

dw = 2.1413366

Source#

fgls.src