Learn R Programming

gmvarkit (version 1.4.1)

plot.qrtest: Quantile residual tests

Description

quantile_residual_tests performs quantile residual tests described by Kalliovirta and Saikkonen 2010, testing autocorrelation, conditional heteroskedasticity, and normality.

Usage

# S3 method for qrtest
plot(x, ...)

# S3 method for qrtest print(x, ..., digits = 3)

quantile_residual_tests( gmvar, lags_ac = c(1, 3, 6, 12), lags_ch = lags_ac, nsimu = 1, print_res = TRUE, stat_tol, posdef_tol )

Arguments

x

object of class 'qrtest' generated by the function quantile_residual_tests).

...

currently not used.

digits

the number of decimals to print

gmvar

an object of class 'gmvar' created with fitGMVAR or GMVAR.

lags_ac

a positive integer vector specifying the lags used to test autocorrelation.

lags_ch

a positive integer vector specifying the lags used to test conditional heteroskedasticity.

nsimu

to how many simulations should the covariance matrix Omega used in the qr-tests be based on? If smaller than sample size, then the covariance matrix will be evaluated from the sample. Larger number of simulations might improve the tests size properties but it increases the computation time.

print_res

should the test results be printed while computing the tests?

stat_tol

numerical tolerance for stationarity of the AR parameters: if the "bold A" matrix of any regime has eigenvalues larger that 1 - stat_tol the model is classified as non-stationary. Note that if the tolerance is too small, numerical evaluation of the log-likelihood might fail and cause error.

posdef_tol

numerical tolerance for positive definiteness of the error term covariance matrices: if the error term covariance matrix of any regime has eigenvalues smaller than this, the model is classified as not satisfying positive definiteness assumption. Note that if the tolerance is too small, numerical evaluation of the log-likelihood might fail and cause error.

Value

Returns an object of class 'qrtest' which has its own print method. The returned object is a list containing the quantile residual test results for normality, autocorrelation, and conditional heteroskedasticity. The autocorrelation and conditional heteroskedasticity results also contain the associated (vectorized) individual statistics divided by their standard errors (see Kalliovirta and Saikkonen 2010, s.17-20) under the label $ind_stats.

Methods (by generic)

  • plot: Plot p-values of the autocorrelation and conditional heteroskedasticity tests.

  • print: Print method for class 'qrtest'

Details

If the function fails to calculate the tests because of numerical problems and the parameter values are near the border of the parameter space, it might help to use smaller numerical tolerance for the stationarity and positeve definiteness conditions. The numerical tolerance of an existing model can be changed with the function update_numtols or you can set it directly with the arguments stat_tol and posdef_tol.

References

  • Kalliovirta L., Meitz M. and Saikkonen P. 2016. Gaussian mixture vector autoregression. Journal of Econometrics, 192, 485-498.

  • Kalliovirta L. and Saikkonen P. 2010. Reliable Residuals for Multivariate Nonlinear Time Series Models. Unpublished Revision of HECER Discussion Paper No. 247.

  • Virolainen S. 2020. Structural Gaussian mixture vector autoregressive model. Unpublished working paper, available as arXiv:2007.04713.

See Also

fitGMVAR, GMVAR, quantile_residuals, GIRF, diagnostic_plot, predict.gmvar, profile_logliks, LR_test, Wald_test, cond_moment_plot, update_numtols

Examples

Run this code
# NOT RUN {
## These are long running examples that use parallel computing!
## The below examples take about 30 seconds to run.

# These examples use the data 'eurusd' which comes with the
# package, but in a scaled form.
data <- cbind(10*eurusd[,1], 100*eurusd[,2])
colnames(data) <- colnames(eurusd)

# GMVAR(1,2) model with default settings
fit12 <- fitGMVAR(data, p=1, M=2, ncalls=1, seeds=7)
qrtests12 <- quantile_residual_tests(fit12)
qrtests12
plot(qrtests12)

# Structural GMVAR(1,2) model identified with sign
# constraints and build with hand-specified parameter values.
# Tests based on simulation procedure with nsimu=1000:
W_122 <- matrix(c(1, 1, -1, 1), nrow=2)
params12s <- c(0.624, -0.127, 3.248, 7.916, 0.959, 0.089, -0.006, 1.006,
 0.952, -0.037, -0.019, 0.943, 1.312, 0.879, -0.155, 2.243, 3.997,
 1.798, 0.788)
fit12s <- GMVAR(data, p=1, M=2, params=params12s,
                structural_pars=list(W=W_122))
qrtests12s <- quantile_residual_tests(fit12s, nsimu=1000)
qrtests12s
# }

Run the code above in your browser using DataLab