*! version 1.0.0 03jun2026

Title

tnardlldiag -- Residual diagnostics after tnardll

Syntax

tnardlldiag
[, options]

Main
bglags(#) lag order for the Breusch-Godfrey serial-correlation test; default bglags(4)

archlags(#) lag order for the Engle ARCH-LM test; default archlags(4)

resetpow(#) highest power of the fitted value in the Ramsey RESET test; default resetpow(3)

tnardlldiag is for use after tnardll.

Description

tnardlldiag reports a suite of specification diagnostics computed on the
residuals of the unrestricted error-correction model fitted by tnardll.
The threshold design is rebuilt from the stored thresholds, so the residuals
reproduce the estimator exactly. Four families of tests are reported:

1. Serial correlation - the Breusch-Godfrey LM test for
autocorrelation up to bglags() lags. The residuals are regressed on the
model regressors and bglags lagged residuals (presample residuals set to
zero); the statistic is n-R2 and is referred to a chi-squared
distribution with bglags() degrees of freedom.

2. Heteroskedasticity - the Engle ARCH-LM test (squared
residuals on archlags() of their own lags) and a Breusch-Pagan test (the
Koenker n-R2 form, squared residuals on the model regressors).

3. Normality - the Jarque-Bera test, with the sample skewness
and kurtosis of the residuals.

4. Functional form - the Ramsey RESET test, which adds powers
2..resetpow() of the fitted value to the model and tests their joint
significance with an F-test.

Options

bglags(#) sets the number of lags in the Breusch-Godfrey test. Must be a
positive integer; default bglags(4).

archlags(#) sets the number of lags in the Engle ARCH-LM test. Must be a
positive integer; default archlags(4).

resetpow(#) sets the highest power of the fitted value used by the Ramsey
RESET test; powers 2 through # are added. Must be at least 2;
default resetpow(3) (adds the square and cube of the fit).

Remarks

The diagnostics are computed on the same estimation sample as the fitted
tnardll model. Because tnardll posts a Mata-built coefficient
vector rather than a regress-type fit, the standard estat
postestimation tests are not available; tnardlldiag provides the
equivalent residual diagnostics directly. A well-specified model with
independent, homoskedastic, normal errors should fail to reject all five nulls.

Examples

Fit the model, then run the default diagnostics:

. tnardll y x, lags(1 1) regimes(2)

. tnardlldiag

Customise the lag orders and RESET powers:

. tnardlldiag, bglags(8) archlags(6) resetpow(4)

Recover a single statistic for further work:

. tnardlldiag

. display r(bg_p)

Stored results

tnardlldiag stores the following in r():

Scalars

r(bg), r(bg_df), r(bg_p) Breusch-Godfrey LM statistic, df and p-value

r(arch), r(arch_df), r(arch_p) Engle ARCH-LM statistic, df and p-value

r(bp), r(bp_df), r(bp_p) Breusch-Pagan statistic, df and p-value

r(jb), r(jb_p) Jarque-Bera statistic and p-value

r(skewness), r(kurtosis) residual skewness and kurtosis

r(reset_F), r(reset_df1), r(reset_df2), r(reset_p) Ramsey RESET F, numerator df, denominator df and p-value

Author

Dr Merwan Roudane

merwanroudane920@gmail.com

github.com/merwanroudane

See tnardll for the model, references, and the full list of
stored estimation results.

Also see

Estimation: tnardll

Postestimation: tnardllmult (cumulative dynamic multipliers)