| rboot.normality | R Documentation |
Bootstraps the distribution of the Jarque-Bera test for individual VAR and VECM as described by Kilian, Demiroglu (2000).
rboot.normality(x, n.boot = 1000, n.cores = 1, fix_beta = FALSE)
x |
VAR object of class ' |
n.boot |
Integer. Number of bootstrap iterations. |
n.cores |
Integer. Number of allocated processor cores. |
fix_beta |
Logical. If |
A list of class 'rboot' with elements:
sim |
Array of dimension |
stats |
Matrix of dimension |
pvals |
Matrix of dimension |
varx |
Input VAR object of class ' |
args_rboot |
List of characters and integers indicating the test and specifications that have been used. |
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.
... 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.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.