R: GOF Testing Transformations for Archimedean Copulas
gtrafo
R Documentation
GOF Testing Transformations for Archimedean Copulas
Description
Compute the following goodness-of-fit (GOF) testing transformations,
Rosenblatt's transformation rtrafo()
is also of
importance outside of GOF computations: The Rosenblatt
transformation is used for computing conditional copulas and
for sampling purposes. Currently, rtrafo() is applicable
to elliptical and Archimedean copulas.
htrafo()
the transformation described in Hering and Hofert
(2014), for Archimedean copulas.
n x d-matrix with values in [0,1]. If
inverse=FALSE (the default), u contains
(pseudo-/copula-)observations from the copula cop based on
which the transformation is carried out; consider applying the
function pobs() first in order to obtain u. If
inverse=TRUE, u contains U[0,1]^d distributed
values which are transformed to copula-based (cop) ones.
cop
a "Copula" with specified parameters
based on which the transformation is computed. For htrafo(),
currently only Archimedean copulas are supported (specified as
"outer_nacopula"), whereas for rtrafo(),
hierarchical Archimedean and elliptical copulas (see
ellipCopula) are allowed.
j.ind
NULL (in which case the Rosenblatt
transformation is computed (all components)) or an
integer between 2 and d
indicating the conditional distribution which is to be computed.
n.MC
parameter n.MC for K (for htrafo)
or for approximating the derivatives involved in the Rosenblatt
transform for Archimedean copulas (for rtrafo).
inverse
logical indicating whether the inverse of the
transformation is returned.
log
logical specifying if the logarithm of the transformation,
i.e., conditional distributions is desired.
include.K
logical indicating whether the last component, involving the
Kendall distribution function K, is used in htrafo.
method
method to compute qK.
u.grid
argument of qK (for method="discrete").
...
additional arguments passed to qK() if
inverse is true.
Details
rtrafo
Given a d-dimensional random vector
U following an Archimedean copula C with
generator ψ, the conditional copula of U_j=u_j given
U_1=u_1,..., U_{j-1}=u_{j-1} is
given by
This formula is either evaluated with the exact derivatives or, if
n.MC is positive, via Monte Carlo; see absdPsiMC.
Rosenblatt (1952) showed that
U' ~ U[0,1]^m, where
U'_1 = U_1,
U'_2 = C(U_2 | U_1), ..., and
U'_m = C(U_m | U_1,..., U_{m-1}).
rtrafo applies this transformation row-wise to u
(with default m=d) and thus returns an n x
m-matrix.
The inverse transformation (inverse=TRUE) applied to
U[0,1]^d data is known as “conditional distribution
method” for sampling.
Note that for the Clayton, the Gauss and the t copula, both the
conditional copulas and their inverses are known explicitly and
rtrafo() utilizes these explicit forms.
htrafo
Given a d-dimensional random vector
U following an Archimedean copula C with
generator ψ, Hering and Hofert (2014) showed that
U'~U[0,1]^d, where
htrafo applies this transformation row-wise to
u and thus returns either an n x d- or an
n x (d-1)-matrix, depending on whether the last
component U'_d which involves the (possibly
numerically challenging) Kendall distribution function K is used
(include.K=TRUE) or not (include.K=FALSE).
Value
htrafo() returns an
n x d- or n x (d-1)-matrix
(depending on whether include.K is TRUE or
FALSE) containing the transformed input u.
rtrafo() returns an n x d-matrix containing the
transformed input u.
Author(s)
Marius Hofert, Martin Maechler.
References
Genest, C., R<c3><83><c2><a9>millard, B., and Beaudoin, D. (2009).
Goodness-of-fit tests for copulas: A review and a power study.
Insurance: Mathematics and Economics44, 199–213.
Rosenblatt, M. (1952).
Remarks on a Multivariate Transformation,
The Annals of Mathematical Statistics23, 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<c3><83><c2><a4>chler, M., and McNeil, A. J. (2012).
Likelihood inference for Archimedean copulas in high dimensions
under known margins. Journal of Multivariate Analysis110, 133–150.
See Also
gofCopula where both transformations are applied or
emde where htrafo is applied.
Examples
tau <- 0.5
(theta <- copGumbel@iTau(tau)) # 2
(copG <- onacopulaL("Gumbel", list(theta, 1:5))) # d = 5
set.seed(1)
n <- 1000
x <- rnacopula(n, copG)
x <- qnorm(x) # x now follows a meta-Gumbel model with N(0,1) marginals
u <- pobs(x) # build pseudo-observations
## graphically check if the data comes from a meta-Gumbel model
## with the transformation of Hering and Hofert (2014):
u.h <- htrafo(u, cop=copG) # transform the data
pairs(u.h, gap=0, cex=0.2) # looks good
## with the transformation of Rosenblatt (1952):
u.r <- rtrafo(u, cop=copG) # transform the data
pairs(u.r, gap=0, cex=0.2) # looks good
## what about a meta-Clayton model?
## the parameter is chosen such that Kendall's tau equals (the same) tau
copC <- onacopulaL("Clayton", list(copClayton@iTau(tau), 1:5))
## plot of the transformed data (Hering and Hofert (2014)) to see the
## deviations from uniformity
u.H <- htrafo(u, cop=copC) # transform the data
pairs(u.H, gap=0, cex=0.2) # clearly visible
## plot of the transformed data (Rosenblatt (1952)) to see the
## deviations from uniformity
u.R <- rtrafo(u, cop=copC) # transform the data
pairs(u.R, gap=0, cex=0.2) # clearly visible
## rtrafo() for elliptical:
fN <- fitCopula(normalCopula(dim=ncol(u)), u) # fit a Gauss copula
pairs(rtrafo(u, cop=fN@copula), gap=0, cex=0.2) # visible but not so clearly
if(copula:::doExtras()) {
f.t <- fitCopula(tCopula(dim=ncol(u)), u)
tCop <- f.t@copula
} else {
tCop <- tCopula(param = 0.685, df = 7, dim=ncol(u))
}
u.Rt <- rtrafo(u, cop=tCop) # transform with a fitted t copula
pairs(u.Rt, gap=0, cex=0.2) # *not* clearly visible