rotCopula {copula} | R Documentation

## Construction and Class of "Rotated" Copulas

### Description

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

### Usage

    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 rotated 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`:

  a `character` string describing the rotated copula.

### See Also

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

### Examples

    ## 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]

[Package copula version 0.999-15 Index]