-------------------------------------------------------------------------------
Post-estimation residual diagnostics for time series
Syntax
armadiag [varname] [if] [in] [, arch dfc(d) hetrobust lags(p) level(alpha) yw nograph table linscale force]
Description
armadiag is a post-estimation diagnostic tool for use after arch, arima or regress. The residuals (standardized residuals with arch) are plotted together with autocorrelations, partial autocorrelations and p-values of the Ljung-Box Q-statistic. The variable varname is used instead of residuals if varname is specified.
Optionally the square of the variable/residuals/standardized residuals is used to allow detection of (remaining) ARCH-effects.
The degrees of freedom of the Q-statistic are adjusted for the number of estimated ARMA-parameters and/or lags of the dependent variable. When the squared residuals are investigated the degrees of freedom are corrected for the number of ARCH-parameters.
Residuals are calculated for the estimation sample unless if or in is specified.
You must tsset your data before using armadiag, see [TS] tsset.
varname may contain time-series operators; see tsvarlist.
Options
option Description -------------------------------------------------------------------------
arch Diagnostics for ARCH, i.e. the square of the residuals, standardized residuals or variabe is plotted with autocorrelations, partial autocorrelations and Q-stat p-values for the square. Degrees of freedom are adjusted for the number or ARCH-parameters.
dfc(n) Override default degrees of freedom correction. The default is to subtract the number of lagged dependent variables and ARMA terms for models estimated with arch, arima and regress. If arch is specified the number of ARCH-terms are subtracted for models estimated with arch.
hetrobust Calculate Q-statistics that are robust to heteroskedasticity of the ARCH-variety. Milhøj has shown that the variance of the estimated autocorrelations is different from 1/T when there is ARCH and hetrobust corrects for this by scaling with a consistent estimate of the variance.
lags(p) The number of lags to calculate statistics for. Default is min(int(T/2)-2,40)
level(alpha) Level for "confidence bands" in autocorrelation and partial autocorrelation plots. Specified this way for consistency with ac and pac which has it wrong. These are not confidence intervals, a confidence interval would be be centered on the estimate. They are 1-alpha critical values for testing the null that the autocorrelation or partial autocorrelation is zero. The default is alpha=95, i.e. 5% critical values.
yw Calculate partial autocorrelations by using Yule-Walker equations
nograph Do not plot results.
table Print results in a table like corrgram
linscale Plot p-values for Q-statistics on a linear scale. By default the p-values are plotted on what is almost a log scale to make the more interesting, small, p-values easier to distinguish.
force Calculates statistics for residuals from other commands than arch, arima or regress. This may or may not make sense. Use at your own risk
References
Milhøj, A., (1985), "The Moment Structure of ARCH Processes," Scandinavian Journal of Statistics, 12, 281-292.
Examples
Setup . webuse air2 . gen lnair = ln(air)
Plot data, autocorrelations and partial autocorrelations for model order identification . armadiag lnair . armadiag d.lnair . armadiag s12.lnair . armadiag ds12.lnair
Fit "airline model" and plot residual diagnostics . arima lnair, arima(0,1,1) sarima(0,1,1,12) . armadiag
Check for presence of ARCH in residuals . armadiag, arch
Author
Sune Karlsson, Örebro University, Sweden sune.karlsson@oru.se
Also see