diagnostic_plot: Quantile residual based diagnostic plots for GMAR, StMAR, and...

Description Usage Arguments Details Value Suggested packages References See Also Examples

View source: R/diagnosticPlot.R

Description

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

Usage

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

Arguments

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

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

Value

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.

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

References

See Also

profile_logliks, get_foc, fitGSMAR, cond_moment_plot, quantile_residual_tests, quantile_residual_plot, simulate.gsmar, LR_test, Wald_test

Examples

 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)

uGMAR documentation built on Jan. 24, 2022, 5:10 p.m.