View source: R/RVineGofTest3.R
RVineGofTest | R Documentation |
This function performs a goodness-of-fit test for R-vine copula models. There are 15 different goodness-of-fit tests implemented, described in Schepsmeier (2013).
RVineGofTest(
data,
RVM,
method = "White",
statistic = "CvM",
B = 200,
alpha = 2
)
data |
An N x d data matrix (with uniform margins). |
RVM |
|
method |
A string indicating the goodness-of-fit method: |
statistic |
A string indicating the goodness-of-fit test statistic
type: |
B |
an integer for the number of bootstrap steps (default |
alpha |
an integer of the set |
method = "White"
:
This goodness-of fit test uses the information
matrix equality of White (1982) and was original investigated by Huang and
Prokhorov (2011) for copulas.
Schepsmeier (2012) enhanced their approach
to the vine copula case.
The main contribution is that under correct
model specification the Fisher Information can be equivalently calculated as
minus the expected Hessian matrix or as the expected outer product of the
score function.
The null hypothesis is
H_0: \boldsymbol{H}(\theta) + \boldsymbol{C}(\theta) = 0
against the alternative
H_1: \boldsymbol{H}(\theta) +
\boldsymbol{C}(\theta) \neq 0 ,
where
\boldsymbol{H}(\theta)
is the expected Hessian matrix and
\boldsymbol{C}(\theta)
is the expected outer product of the
score function.
For the calculation of the test statistic we use the
consistent maximum likelihood estimator \hat{\theta}
and the sample
counter parts of \boldsymbol{H}(\theta)
and
\boldsymbol{C}(\theta)
.
The correction of the
Covariance-Matrix in the test statistic for the uncertainty in the margins
is skipped. The implemented test assumes that there is no uncertainty in the
margins. The correction can be found in Huang and Prokhorov (2011) for
bivariate copulas and in Schepsmeier (2013) for vine copulas. It involves
multi-dimensional integrals.
method = "IR"
:
As the White test the information matrix ratio
test is based on the expected Hessian matrix
\boldsymbol{H}(\theta)
and the expected outer product of
the score function \boldsymbol{C}(\theta)
.
H_0:-\boldsymbol{H}(\theta)^{-1}\boldsymbol{C}(\theta) = I_{p}
against the alternative
H_1:
-\boldsymbol{H}(\theta)^{-1}\boldsymbol{C}(\theta) \neq I_{p} .
The test statistic can then be calculated as
IR_n:=tr(\Phi(\theta))/p
with
\Phi(\theta)=-\boldsymbol{H}(\theta)^{-1}\boldsymbol{C}(\theta)
,
p
is the number of parameters, i.e. the length of \theta
, and
tr(A)
is the trace of the matrix A
For details see Schepsmeier (2013)
method = "Breymann"
, method = "Berg"
and method = "Berg2"
:
These tests are based on the multivariate probability integral
transform (PIT) applied in RVinePIT()
. The multivariate data
y_{i}
returned form the PIT are aggregated to univariate data by
different aggregation functions \Gamma(\cdot)
in the sum
s_t=\sum_{i=1}^d \Gamma(y_{it}), t=1,...,n
.
In Breymann et al. (2003) the weight function is suggested as
\Gamma(\cdot)=\Phi^{-1}(\cdot)^2
, while in
Berg and Bakken (2007) the weight function is either
\Gamma(\cdot)=|\cdot-0.5|
(method="Berg"
) or
\Gamma(\cdot)=(\cdot-0.5)^{\alpha},\alpha=2,4,6,...
(method="Berg2"
).
Furthermore, the "Berg"
and
"Berg2"
test are based on the order statistics of the PIT returns.
See Berg and Bakken (2007) or Schepsmeier (2013) for details.
method = "ECP"
and method = "ECP2"
:
Both tests are test
for H_0: C \in C_0
against H_1: C \notin C_0
where C denotes the
(vine) copula distribution function and C_0
is a class of parametric
(vine) copulas with \Theta\subseteq R^p
being the parameter space of
dimension p. They are based on the empirical copula process (ECP)
\hat{C}_n(u)-C_{\hat{\theta}_n}(u),
with
u=(u_1,\ldots,u_d)\in[0,1]^d
and
\hat{C}_n(u) =
\frac{1}{n+1}\sum_{t=1}^n \boldsymbol{1}_{\{U_{t1}\leq u_1,\ldots,U_{td}\leq
u_d \}}
.
The ECP is utilized in a multivariate
Cramer-von Mises (CvM) or multivariate Kolmogorov-Smirnov (KS) based test
statistic. An extension of the ECP-test is the combination of the
multivariate PIT approach with the ECP. The general idea is that the
transformed data of a multivariate PIT should be "close" to the independence
copula Genest et al. (2009). Thus a distance of CvM or KS type between them
is considered. This approach is called ECP2. Again we refer to Schepsmeier
(2013) for details.
For method = "White"
:
White |
test statistic |
p.value |
p-value, either asymptotic for |
For method = "IR"
:
IR |
test statistic (raw version as stated above) |
p.value |
So far no p-value is returned nigher a asymptotic nor a bootstrapped one. How to calculated a bootstrapped p-value is explained in Schepsmeier (2013). Be aware, that the test statistics than have to be adjusted with the empirical variance. |
For method = "Breymann"
, method = "Berg"
and method = "Berg2"
:
CvM , KS , AD |
test statistic according to
the choice of |
p.value |
p-value, either asymptotic
for |
For method = "ECP"
and method = "ECP2"
:
CvM , KS |
test statistic according to the
choice of |
p.value |
bootstrapped p-value |
Warning: The code for all the p-values are not yet approved since some of them are
moved from R-code to C-code. If you need p-values the best way is to write your own
algorithm as suggested in Schepsmeier (2013) to get bootstrapped p-values.
Ulf Schepsmeier
Berg, D. and H. Bakken (2007) A copula goodness-of-fit approach based on the conditional probability integral transformation. https://www.danielberg.no/publications/Btest.pdf
Breymann, W., A. Dias and P. Embrechts (2003) Dependence structures for multivariate high-frequency data in finance. Quantitative Finance 3, 1-14
Genest, C., B. Remillard, and D. Beaudoin (2009) Goodness-of-fit tests for copulas: a review and power study. Insur. Math. Econ. 44, 199-213.
Huang, w. and A. Prokhorov (2011). A goodness-of-fit test for copulas. to appear in Econometric Reviews
Schepsmeier, U. (2013) A goodness-of-fit test for regular vine copula models. Preprint https://arxiv.org/abs/1306.0818
Schepsmeier, U. (2015) Efficient information based goodness-of-fit tests for vine copula models with fixed margins. Journal of Multivariate Analysis 138, 34-52.
White, H. (1982) Maximum likelihood estimation of misspecified models, Econometrica, 50, 1-26.
BiCopGofTest()
, RVinePIT()
## time-consuming example
# load data set
data(daxreturns)
# select the R-vine structure, families and parameters
RVM <- RVineStructureSelect(daxreturns[,1:5], c(1:6))
# White test with asymptotic p-value
RVineGofTest(daxreturns[,1:5], RVM, B = 0)
# ECP2 test with Cramer-von-Mises test statistic and a bootstrap
# with 200 replications for the calculation of the p-value
RVineGofTest(daxreturns[,1:5], RVM, method = "ECP2",
statistic = "CvM", B = 200)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.