Learn R Programming

pvars (version 1.1.1)

rboot.normality: Bootstrap for JB normality test

Description

Bootstraps the distribution of the Jarque-Bera test for individual VAR and VECM as described by Kilian, Demiroglu (2000).

Usage

rboot.normality(x, n.boot = 1000, n.cores = 1, fix_beta = FALSE)

Value

A list of class 'rboot' with elements:

sim

Array of dimension \((3 \times (1+K) \times\) n.boot) containing the n.boot iteration results for (i) the JB, skewness and kurtosis test and for (ii) the multivariate and each univariate test for the \(K\) residual time series.

stats

Matrix of dimension \((3 \times (1+K))\) containing the empirical test statistics.

pvals

Matrix of dimension \((3 \times (1+K))\) containing the \(p\)-values.

varx

Input VAR object of class 'varx'.

args_rboot

List of characters and integers indicating the test and specifications that have been used.

Arguments

x

VAR object of class 'varx' or any other that will be coerced to 'varx'.

n.boot

Integer. Number of bootstrap iterations.

n.cores

Integer. Number of allocated processor cores.

fix_beta

Logical. If TRUE, the cointegrating vectors \(\beta\) are fixed over all bootstrap iterations. Kilian and Demiroglu (2000:43) suggest this for VECM with known \(\beta\). Ignored in case of rank-unrestricted VAR.

References

Jarque, C. M. and Bera, A. K. (1987): "A Test for Normality of Observations and Regression Residuals", International Statistical Review, 55, pp. 163-172.

Kilian, L. and Demiroglu, U. (2000): "Residual-Based Tests for Normality in Autoregressions: Asymptotic Theory and Simulation Evidence", Journal of Business and Economic Statistics, 32, pp. 40-50.

See Also

... the normality.test by Pfaff (2008) in vars, which relies on theoretical distributions. Just as this asymptotic version, the bootstrapped version is computed by using the residuals that are standardized by a Cholesky decomposition of the residual covariance matrix. Therefore, the results of the multivariate test depend on the ordering of the variables in the VAR model.

Examples

Run this code
# \donttest{
# select minimal or full example #
is_min = TRUE
n.boot = ifelse(is_min, 50, 5000)

# prepare the data, estimate and test the VAR model #
set.seed(23211)
library("vars")
data("Canada")
exogen = cbind(qtrend=(1:nrow(Canada))^2)  # quadratic trend
R.vars = VAR(Canada, p=2, type="both", exogen=exogen)
R.norm = rboot.normality(x=R.vars, n.boot=n.boot, n.cores=1)

# density plot #
library("ggplot2")
R.data = data.frame(t(R.norm$sim[ , "MULTI", ]))
R.args = list(df=2*R.vars$K)
F.density = ggplot() +
  stat_density(data=R.data, aes(x=JB, color="bootstrap"), geom="line") +
  stat_function(fun=dchisq, args=R.args, n=500, aes(color="theoretical")) +
  labs(x="JB statistic", y="Density", color="Distribution", title=NULL) +
  theme_bw()
plot(F.density)
# }

Run the code above in your browser using DataLab