Learn R Programming

QRM (version 0.4-31)

CopulaAC: Archimedean Copulae

Description

Functions for ealuating densities of Archimedean copulae, generating random variates and fitting data to AC

Usage

dcopula.AC(u, theta, name = c("clayton", "gumbel"), log = TRUE)
dcopula.clayton(u, theta, log = FALSE)
dcopula.gumbel(u, theta, log = FALSE)
rAC(name = c("clayton", "gumbel", "frank", "BB9", "GIG"), n, d, theta)
rACp(name = c("clayton", "gumbel", "frank", "BB9", "GIG"), n, d, theta, A)
rcopula.gumbel(n, theta, d)
rcopula.clayton(n, theta, d)
rcopula.frank(n, theta, d)
rstable(n, alpha, beta = 1)
rFrankMix(n, theta)
rBB9Mix(n, theta)
rcopula.Gumbel2Gp(n = 1000, gpsizes = c(2, 2), theta = c(2, 3, 5))
rcopula.GumbelNested(n, theta)
fit.AC(Udata, name = c("clayton", "gumbel"), initial = 2, ...)

Arguments

A

matrix, dimension \(d \times p\) containing asymmetry parameters. Rowsums must be equal to one.

alpha

numeric, parameter \(0 < \alpha \le 2\), but \(\alpha \ne 1\).

beta

numeric, parameter \(-1 \le \beta \le 1\).

d

integer, dimension of copula.

gpsizes

vector, length of two, containing the group sizes.

initial

numeric, initial value used by fit.AC() in the call to nlminb().

log

logical, whether log density values should be returned

n

integer, count of random variates.

name

character, name of copula.

theta

vector, copula parameter(s).

u

matrix, dimension \(n \times d\), where d is the dimension of the copula and n is the number of vector values at which to evaluate density.

Udata

matrix, pseudo-uniform observations.

...

ellipsis, arguments are passed down to nlminb().

Value

vector or matrix in case of the density and random-generator related functions and a list object for the fitting function.

Details

The function dcopula.AC() is a generic function, designed such that additional copulae, or expressions for densities of higher-dimensional copulae may be added. Clayton copula works in any dimension at present but Gumbel is only implemented for \(d = 2\). To extend, one must calculate the d-th derivative of the generator inverse and take the logarithm of absolute value; this is the term called loggfunc. In addition, for other copulae, one needs the generator \(\phi\) and the log of the negative value of its first derivative lnegphidash. The random variates from rAC() with arbitrary dimension are generated by using the mixture construction of Marshall and Olkin. It may be used in place of the other functions rcopula.clayton(), rcopula.gumbel(), and rcopula.frank(). In addition, it allows simulation of BB9 and GIG copulas which don't have individual simulation routines. For the Clayton and Gumbel copulae, see page 192 and 222--224 in QRM. The random variates for the BB9 and Frank copula are obtained from a mixing distribution using a Laplace transform method (see page 224 of QRM). The function rcopula.Gumbel2Gp() generates sample from a Gumbel copula with two-group structure constructed using three Gumbel generators (see pages 222-224 and 227 of QRM). The function rcopula.gumbelNested() generates sample from a d-dimensional Gumbel copula with nested structure constructed using \((d-1)\) Gumbel generators. For the random variates of the Stable distribution, a default value \(\beta = 1\) is used; combined with a value for \(\alpha < 1\) yields a positive stable distribution, which is required for Gumbel copula generation; the case \(\alpha = 1\) has not been implemented.

See Also

nlminb

Examples

Run this code
# NOT RUN {
## Gumbel
r1 <- rAC("gumbel", n = 50, d = 7, theta = 3)
head(r1)
## Weighted Gumbel
alpha <- c(0.95,0.7)
wtmatrix <- cbind(alpha, 1 - alpha)
r2 <- rACp(name = "gumbel", n = 1000, d = 2, theta = c(4, 1),
           A = wtmatrix)
head(r2)
## Gumbel with two-group structure
r3 <- rcopula.Gumbel2Gp(n = 3000, gpsizes = c(3, 4),
                        theta = c(2, 3, 5)) 
pairs(r3)
## Nested Gumbel
r4 <- rcopula.GumbelNested(n=3000,theta=1:6) 
pairs(r4) 
## Frank
r5 <- rcopula.frank(1000, 2, 4) 
pairs(r5)
## Fitting of Gumbel and Clayton
data(smi)
data(ftse100)
s1 <- window(ftse100, "1990-11-09", "2004-03-25")
s1a <- alignDailySeries(s1)
s2a <- alignDailySeries(smi)
idx <- merge(s1a, s2a)
r <-returns(idx)
rp <- series(window(r, "1994-01-01", "2003-12-31"))
rp <- rp[(rp[, 1] != 0) & (rp[, 2] !=0), ]
Udata <- apply(rp, 2, edf, adjust = 1)
mod.gumbel <- fit.AC(Udata, "gumbel")
mod.clayton <- fit.AC(Udata, "clayton")
mod.clayton
# }

Run the code above in your browser using DataLab