Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gofTstat

Goodness-of-fit Test Statistics


Description

gofTstat() computes various goodness-of-fit test statistics typically used in gofCopula(*, simulation = "pb"). gofT2stat() computes the two-sample goodness of fit test statistic of Rémillard and Scaillet (2009).

Usage

gofTstat(u, method = c("Sn", "SnB", "SnC", "AnChisq", "AnGamma"),
         useR = FALSE, ...)
gofT2stat(u1, u2, useR = FALSE)

Arguments

u

n x d-matrix of values in [0,1], supposedly independent uniform observations in the hypercube, that is, U_i ~ U[0,1]^d, i.i.d., for i in 1..n.

u1, u2

n x d-matrices of copula samples to be compare against. The two matrices must have an equal number of columns d but can differ in n (number of rows).

method

a character string specifying the goodness-of-fit test statistic to be used, which has to be one (or a unique abbreviation) of

"Sn"

for computing the test statistic S_n from Genest, Rémillard, Beaudoin (2009).

"SnB"

for computing the test statistic S_n^(B) from Genest, Rémillard, Beaudoin (2009).

"SnC"

for computing the test statistic S_n^(C) from Genest et al. (2009).

"AnChisq"

Anderson-Darling test statistic for computing (supposedly) U[0,1]-distributed (under H_0) random variates via the distribution function of the chi-square distribution with d degrees of freedom. To be more precise, the Anderson-Darling test statistc of the variates

pchisq((Phi^{-1}(u_{i1}))^2+...+(Phi^{-1}(u_{id}))^2, df=d)

is computed (via ADGofTest::ad.test), where Phi^{-1} denotes the quantile function of the standard normal distribution function, pchisq(.,df=d) denotes the distribution function of the chi-square distribution with d degrees of freedom, and u_{ij} is the jth component in the ith row of u.

"AnGamma"

similar to method="AnChisq" but based on the variates

pgamma(-log(u_{i1})-...-log(u_{id}), shape=d),

where pgamma(.,shape=d) denotes the distribution function of the gamma distribution with shape parameter d and shape parameter one (being equal to an Erlang(d) distribution function).

useR

logical indicating whether an R or C implementation is used.

...

additional arguments passed for computing the different test statistics.

Details

These functions should be used with care. The different test statistics were implemented (partly) for different purposes and goodness-of-fit tests and should be used only with knowledge about such test (see the references for more details).

Value

The value of the test statistic, a numeric.

References

Genest, C., Rémillard, B., and Beaudoin, D. (2009), Goodness-of-fit tests for copulas: A review and a power study Insurance: Mathematics and Economics 44, 199–213.

Rosenblatt, M. (1952), Remarks on a Multivariate Transformation, The Annals of Mathematical Statistics 23, 3, 470–472.

Hering, C. and Hofert, M. (2014), Goodness-of-fit tests for Archimedean copulas in high dimensions, Innovations in Quantitative Risk Management.

Hofert, M., Mächler, M., and McNeil, A. J. (2012). Likelihood inference for Archimedean copulas in high dimensions under known margins. Journal of Multivariate Analysis 110, 133–150.

Rémillard, B. and Scaillet, O. (2009). Testing for equality between two copulas. Journal of Multivariate Analysis 100, 377–386.

See Also

gofCopula() for goodness-of-fit tests where (some of) the test statistics of gofTstat() are used.

Examples

## generate data
cop <- archmCopula("Gumbel", param=iTau(gumbelCopula(), 0.5), dim=5)
set.seed(1)
U <- rCopula(1000, cop)

## compute Sn (as is done in a parametric bootstrap, for example)
Uhat <- pobs(U) # pseudo-observations
u <- cCopula(Uhat, copula = cop) # Rosenblatt transformed data (with correct copula)
gofTstat(u, method = "Sn", copula = cop) # compute test statistic Sn; requires copula argument

copula

Multivariate Dependence with Copulas

v1.0-1
GPL (>= 3) | file LICENCE
Authors
Marius Hofert [aut] (<https://orcid.org/0000-0001-8009-4665>), Ivan Kojadinovic [aut] (<https://orcid.org/0000-0002-2903-1543>), Martin Maechler [aut, cre] (<https://orcid.org/0000-0002-8685-9910>), Jun Yan [aut] (<https://orcid.org/0000-0003-4401-7296>), Johanna G. Nešlehová [ctb] (evTestK(), <https://orcid.org/0000-0001-9634-4796>), Rebecca Morger [ctb] (fitCopula.ml(): code for free mixCopula weight parameters)
Initial release
2020-12-07

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.