Description Usage Arguments Details Value Suggested packages References See Also Examples

View source: R/diagnosticPlot.R

`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).

1 | ```
diagnostic_plot(gsmar, nlags = 20, nsimu = 1, plot_indstats = FALSE)
``` |

`gsmar` |
a class 'gsmar' object, typically generated by |

`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` |
set |

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).

`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.

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".

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**, 247-266.Meitz M., Preve D., Saikkonen P. 2021. A mixture autoregressive model based on Student's t-distribution.

*Communications in Statistics - Theory and Methods*, doi: 10.1080/03610926.2021.1916531Virolainen S. 2021. A mixture autoregressive model based on Gaussian and Student's t-distributions. Studies in Nonlinear Dynamics & Econometrics, doi: 10.1515/snde-2020-0060

`profile_logliks`

, `get_foc`

, `fitGSMAR`

, `cond_moment_plot`

, `quantile_residual_tests`

,
`quantile_residual_plot`

, `simulate.gsmar`

, `LR_test`

, `Wald_test`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
## The below examples the approximately 30 seconds to run.
# G-StMAR model with one GMAR type and one StMAR type regime
fit42gs <- 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)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.