Construction and Class of "Rotated" Copulas

Share:

Description

Constructs a rotated copula from an initial copula and a vector of logicals indicating which dimension to “flip”.

Usage

1
rotCopula(copula, flip = TRUE)

Arguments

copula

an object of class "Copula".

flip

logical vector (of length 1 or dim(copula)) indicating which dimension should be “flipped”; by default, all the components are flipped, implying that the resulting copula is the “survival copula”.

Value

A “rotated” copula object of class "rotCopula".

Slots

of a "rotCopula" object

copula:

Object of class "copula".

flip:

logical vector of length d (the copula dimension) specifying which margins are flipped; corresponds to the flip argument of rotCopula().

dimension:

the copula dimension d, an integer.

parameters:

numeric vector specifying the parameters.

param.lowbnd, and param.upbnd:

numeric vector of the same length as parameters, specifying (component wise) bounds for each of the parameters.

param.names:

character vector (of same length as parameters) with parameter names.

fullname:

deprecated; a character string describing the rotated copula.

Note

Only when there are an even number of flips, the resulting copula can be seen as a rotated version of copula. In the other cases, e.g., flip = c(FALSE,TRUE) in 2d, it is rather a “mirrored” copula.

See Also

fitCopula for fitting such copulas to data, gofCopula for goodness-of-fit tests for such copulas.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
## Two-dimensional examples: First the Clayton(3) survival copula:
survC <- rotCopula(claytonCopula(3)) # default: flip = 'all TRUE'
contourplot2(survC, dCopula)

## Now, a "rotated" Clayton copula:
r10C  <- rotCopula(claytonCopula(3), flip = c(TRUE, FALSE))

contourplot2(r10C, dCopula, nlevels = 20, main = "dCopula(<rotCopula>)")
contourplot2(r10C, pCopula, nlevels = 20, main = "pCopula(<rotCopula>)")
rho(r10C)
tau(r10C) # -0.6

n <- 1000
u <- rCopula(n, r10C)
rho.n <- cor(u[,1], u[,2], method = "spearman")
tau.n <- cor(u[,1], u[,2], method = "kendall")

## "Calibration"
rc. <- rotCopula(claytonCopula(), flip = c(TRUE, FALSE))
iRho(rc., rho.n)
iTau(rc., tau.n)

## Fitting
fitCopula(rc., data = pobs(u), method = "irho")
fitCopula(rc., data = pobs(u), method = "itau")
fitCopula(rc., data = pobs(u), method = "mpl")

## Goodness-of-fit testing -- the first, parametric bootstrap, is *really* slow
## Not run: gofCopula(rc., x = u)
gofCopula(rc., x = u, simulation = "mult")

## A four-dimensional example: a "rotated" Frank copula
rf <- rotCopula(frankCopula(10, dim = 4),
                flip = c(TRUE, FALSE, TRUE, FALSE))

n <- 1000
u <- rCopula(n, rf)
splom2(u)

pCopula(c(0.6,0.7,0.6,0.8), rf)
C.n(cbind(0.6,0.7,0.6,0.8),  u)

## Fitting
(rf. <- rotCopula(frankCopula(dim=4),
                  flip = c(TRUE, FALSE, TRUE, FALSE)))
## fitCopula(rf., data = pobs(u), method = "irho")
## FIXME above: not related to rotCopula but frankCopula
fitCopula(rf., data = pobs(u), method = "itau")
fitCopula(rf., data = pobs(u), method = "mpl")

## Goodness-of-fit testing (first ("PB") is really slow, see above):
## Not run: gofCopula(rf., x = u)
gofCopula(rf., x = u, simulation = "mult") # takes 3.7 sec [lynne, 2015]

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.