ssLjungBox

Purpose

Computes the Ljung-Box test for autocorrelation.

Format

{ Q_stat, p_val } = ssLjungBox(resid)
Parameters

resid (Vector) – Model residuals.

Returns
  • Q_stat (Scalar) – Ljung-Box test statistic for the heteroskedasticity.

  • p_value (Scalar) – P-value for the test statistic for the Ljung-Box test statistic.

Examples

// Generate random vector of residuals
rndseed 929212;
resid = rndn(150, 1);

// Test for heteroskedasticity
{ Q_stat, p_val } = ssLjungBox(resid);

The code above results in the following:

Q_stat = 2.0876
p_val = 0.1485

Source

ssmain.src