Learn R Programming

gofCopula (version 0.1-2)

gofRn: The Rn gof test from package copula

Description

gofRn is a wrapper for the functions gofCopula, fitCopula, ellipCopula and archmCopula from the package copula. It combines these functions to test a dataset for a copula directly without all the necessary intermediate steps. gofRn performs the gof test from Genest et al. (2013) for copulae and compares the empirical copula against a parametric estimate of the copula derived under the null hypothesis. The approximate p-values are computed with a fast multiplier approach. It is just possible to insert datasets of dimension 2 and the possible copulae are "gaussian", "t", "gumbel", "clayton" and "frank". The parameter estimation is performed with pseudo maximum likelihood method. In case the estimation fails, inversion of Kendall's tau is used.

Usage

gofRn(copula, x, M = 1000, param = 0.5, param.est = T, df = 4, df.est = T,
      m_b = 0.5, zeta.m = 0, b_Rn = 0.05, execute.times.comp = T)

Arguments

copula
The copula to test for. Possible are "gaussian", "t", "clayton", "gumbel" and "frank".
x
A matrix containing the residuals of the data.
M
Number of bootstrapping loops.
param
The copula parameter to use, if it shall not be estimated.
param.est
Shall be either TRUE or FALSE. TRUE means that param will be estimated.
df
Degrees of freedom, if not meant to be estimated. Only necessary if tested for "t"-copula.
df.est
Indicates if df shall be estimated. Has to be either FALSE or TRUE, where TRUE means that it will be estimated.
m_b
The power of the statistic.
zeta.m
The adjustment parameter.
b_Rn
The bandwidth for the estimation of the first-order partial derivatives based on the empirical copula.
execute.times.comp
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.

Value

  • A object of the class gofCOP with the components
  • methoda character which informs about the performed analysis
  • erg.testsa matrix with the p-value and test statistic of test

Details

With the pseudo observations $U_{ij}$ for $i = 1, \dots,n$; $j = 1, \dots,d$ and $\mathbf{u} \in [0,1]^d$ is the empirical copula given by $C_n(\mathbf{u}) = \frac{1}{n} \sum_{i = 1}^n \mathbf{I}(U_{i1} \leq u_1, \dots, U_{id} \leq u_d).$ It shall be tested the $H_0$ hypothesis: $$C \in \mathcal{C}_0$$ with $\mathcal{C}_0$ as the true class of copulae under $H_0$. The test statistic $T$ is defined as $$T = n \int_{[0,1]^d} { \frac{C_n(\mathbf{u}) - C_{\theta_n}(\mathbf{u})}{[C_{\theta_n}(\mathbf{u}) {1 - C_{\theta_n}(\mathbf{u})} + \zeta_m]^m} }^2 d C_n(\mathbf{u})$$ with $C_{\theta_n}(\mathbf{u})$ an estimation of $C$ under the $H_0$. $m \geq 0$ and $\zeta_m \geq 0$ are tuning parameters. The approximate p-value is computed by the formula, see copula, $$(0.5 + \sum_{b=1}^N \mathbf{I}(T_b \geq T) / (N+1),$$ where $T$ and $T_b$ denote the test statistic and the bootstrapped test statistc, respectively. This ensures that the approximate p-value is a number strictly between 0 and 1, which is sometimes necessary for further treatments. See Pesarin (2001) for more details.

References

Christian Genest, Wanling Huang and Jean-Marie Dufour (2013). A regularized goodness-of-fit test for copulas. Journal de la Societe Francaise de Statistique et revue de statistique appliquee 154.1: 64-77. Marius Hofert, Ivan Kojadinovic, Martin Maechler, Jun Yan (2014). copula: Multivariate Dependence with Copulas. R package version 0.999-12.. http://CRAN.R-project.org/package=copula Pesarin, F. (2001). Multivariate Permutation Tests: With applications in Biostatistics, Wiley

Examples

Run this code
data = cbind(rnorm(100), rnorm(100))

gofRn("gaussian", data, M = 20)

Run the code above in your browser using DataLab