gofWhite
tests a given 2 dimensional dataset for a copula with the gof test based on White's information matrix equality. The possible copulae are "normal", "t", "gumbel", "clayton" and "frank". See for reference Schepsmeier et al. (2015). The parameter estimation is performed with pseudo maximum likelihood method. In case the estimation fails, inversion of Kendall's tau is used. The margins can be estimated by a bunch of distributions and the time which is necessary for the estimation can be given. The approximate p-values are computed with a parametric bootstrap, which computation can be accelerated by enabling in-build parallel computation. The computation of the test statistic and p-values is performed by corresponding functions from the VineCopula
package.
gofWhite(copula, x, M = 1000, param = 0.5, param.est = T, df = 4, df.est = T,
margins = "ranks", execute.times.comp = T, processes = 1)
The copula to test for. Possible are the copulae "normal"
, "clayton"
, "gumbel"
and "frank"
.
A 2 dimensional matrix containing the residuals of the data.
Number of bootstrap samples.
The parameter to be used.
Shall be either TRUE
or FALSE
. TRUE
means that param
will be estimated with a maximum likelihood estimation.
The degrees of freedom for the "t"
-copula.
Indicates if df
shall be estimated. Has to be either FALSE
or TRUE
, where TRUE
means that it will be estimated.
Specifies which estimation method shall be used in case that the input data are not in the range [0,1]. The default is "ranks"
, which is the standard approach to convert data in such a case. Alternatively can the following distributions be specified: "beta"
, "cauchy"
, Chi-squared ("chisq"
), "f"
, "gamma"
, Log normal ("lnorm"
), Normal ("norm"
), "t"
, "weibull"
, Exponential ("exp"
).
Logical. Defines if the time which the estimation most likely takes shall be computed. It'll be just given if M
is at least 100.
The number of parallel processes which are performed to speed up the bootstrapping. Shouldn't be higher than the number of logical processors. Please see the details.
A object of the class
gofCOP with the components
a character which informs about the performed analysis
a matrix with the p-value and test statistic of test
The details are obtained from Schepsmeier et al. (2015) who states that this test uses the information matrix equality of White (1982). Under correct model specification is the Fisher Information equivalently calculated as minus the expected Hessian matrix or as the expected outer product of the score function. The null hypothesis is $$H_0 : \mathbf{H}(\theta) + \mathbf{S}(\theta) = 0$$ where \(\mathbf{H}(\theta)\) is the expected Hessian matrix and \(\mathbf{S}(\theta)\) is the expected outer product of the score function.
The test statistic is derived by $$T_n = n(\bar{d}(\theta_n))^\top V_{\theta_n}^{-1} \bar{d}(\theta_n)$$ with $$\bar{d}(\theta_n) = \frac{1}{n} \sum_{i=1}^n vech(\mathbf{H}_n(\theta_n|\mathbf{u}) + \mathbf{S}_n(\theta_n|\mathbf{u})),$$
$$d(\theta_n) = vech(\mathbf{H}_n(\theta_n|\mathbf{u}) + \mathbf{S}_n(\theta_n|\mathbf{u})),$$
$$V_{\theta_n} = \frac{1}{n} \sum_{i=1}^n (d(\theta_n) - D_{\theta_n} \mathbf{H}_n(\theta_n)^{-1} \delta l(\theta_n))(d(\theta_n) - D_{\theta_n} \mathbf{H}_n(\theta_n)^{-1} \delta l(\theta_n))^\top$$ and $$D_{\theta_n} = \frac{1}{n} \sum_{i=1}^n [\delta_{\theta_k} d_l(\theta_n)]_{l=1, \dots, \frac{p(p+1)}{2}, k=1, \dots, p}$$ where \(l(\theta_n)\) represents the log likelihood function and \(p\) is the length of the parameter vector \(\theta\).
The test statistic will be rejected if $$T > (1 - \alpha) (\chi^2_{p(p+1)/2})^{-1}.$$
For small values of M
, initializing the parallization via processes
does not make sense. The registration of the parallel processes increases the computation time. Please consider to enable parallelization just for high values of M
.
Ulf Schepsmeier, Jakob Stoeber, Eike Christian Brechmann, Benedikt Graeler (2015). VineCopula: Statistical Inference of Vine Copulas. R package version 1.4.. https://cran.r-project.org/package=VineCopula Schepsmeier, U. and J. Stoeber (2014). Derivatives and Fisher information of bivariate copulas. Statistical Papers, 55(2), 525-542. http://link.springer.com/article/10.1007/s00362-013-0498-x Stoeber, J. and U. Schepsmeier (2013). Estimating standard errors in regular vine copula models Computational Statistics, 28 (6), 2679-2707 Schepsmeier, U. (2015). Efficient information based goodness-of-fit tests for vine copula models with fixed margins. Journal of Multivariate Analysis 138, 34-52. Schepsmeier, U. (2014). A goodness-of-fit test for regular vine copula models.
# NOT RUN {
data(IndexReturns)
gofWhite("normal", IndexReturns[c(1:100),c(1:2)], M = 10)
# }
Run the code above in your browser using DataLab