Quantile residual based diagnostic plots for GMAR, StMAR, and G-StMAR models
Quantile residual based diagnostic plots for GMAR, StMAR, and G-StMAR models
diagnostic_plot plots quantile residual time series, normal QQ-plot, autocorrelation function, and squared quantile residual autocorrelation function. There is an option to also plot the individual statistics associated with the quantile residual tests (for autocorrelation and conditional heteroskedasticity) divided by their approximate standard errors with their approximate 95% critical bounds (see Kalliovirta 2012, Section 3).
gsmar: a class 'gsmar' object, typically generated by fitGSMAR or GSMAR.
nlags: a positive integer specifying how many lags should be calculated for the autocorrelation and conditional heteroscedasticity statistics.
nsimu: a positive integer specifying to how many simulated values from the process the covariance matrix "Omega" (used to compute the tests) should be based on. Larger number of simulations may result more reliable tests but takes longer to compute. If smaller than data size, then "Omega" will be based on the given data. Ignored if plot_indstats==FALSE.
plot_indstats: set TRUE if the individual statistics discussed in Kalliovirta (2012) should be plotted with their approximate 95% critical bounds (this may take some time).
Returns
diagnostic_plot only plots to a graphical device and does not return anything. Use the function quantile_residual_tests in order to obtain the individual statistics.
Details
Sometimes the individual statistics are not plotted because it was not (numerically) possible to calculate all the required statistics. This may suggest that the model is misspecified.
The dashed lines plotted with autocorrelation functions (for quantile residuals and their squares) are plus-minus 1.96∗T−1/2 where T is the sample size (minus the p initial values for conditional models).
Suggested packages
Install the suggested package "gsl" for faster evaluations in the cases of StMAR and G-StMAR models. For large StMAR and G-StMAR models with large data the calculations to obtain the individual statistics may take a significantly long time without the package "gsl".
Examples
## The below examples the approximately 30 seconds to run.# G-StMAR model with one GMAR type and one StMAR type regimefit42gs <- fitGSMAR(M10Y1Y, p=4, M=c(1,1), model="G-StMAR", ncalls=1, seeds=4)diagnostic_plot(fit42gs)# Restricted StMAR model: plot also the individual statistics with# their approximate critical bounds using the given data (and not# simulation procedure)fit42tr <- fitGSMAR(M10Y1Y, p=4, M=2, model="StMAR", restricted=TRUE, ncalls=1, seeds=1)diagnostic_plot(fit42tr, nlags=10, nsimu=1, plot_indstats=TRUE)# GMAR model, plot 30 lags.fit12 <- fitGSMAR(data=simudata, p=1, M=2, model="GMAR", ncalls=1, seeds=1)diagnostic_plot(fit12, nlags=30)
References
Galbraith, R., Galbraith, J. 1974. On the inverses of some patterned matrices arising in the theory of stationary time series. Journal of Applied Probability 11 , 63-71.
Kalliovirta L. (2012) Misspecification tests based on quantile residuals. The Econometrics Journal, 15 , 358-393.
Kalliovirta L., Meitz M. and Saikkonen P. 2015. Gaussian Mixture Autoregressive model for univariate time series. Journal of Time Series Analysis, 36 (2), 247-266.
Meitz M., Preve D., Saikkonen P. 2023. A mixture autoregressive model based on Student's t-distribution. Communications in Statistics - Theory and Methods, 52 (2), 499-515.
Virolainen S. 2022. A mixture autoregressive model based on Gaussian and Student's t-distributions. Studies in Nonlinear Dynamics & Econometrics, 26 (4) 559-580.