Description Usage Arguments Details Value See Also Examples
Functions for ealuating densities of Archimedean copulae, generating random variates and fitting data to AC
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 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, ...)
|
A |
|
alpha |
|
beta |
|
d |
|
gpsizes |
|
initial |
|
log |
|
n |
|
name |
|
theta |
|
u |
|
Udata |
|
... |
ellipsis, arguments are passed down to |
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.
vector or matrix in case of the density and random-generator related functions and a list object for the fitting function.
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 | ## 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
|
Loading required package: gsl
Loading required package: Matrix
Loading required package: mvtnorm
Loading required package: numDeriv
Loading required package: timeSeries
Loading required package: timeDate
Attaching package: 'QRM'
The following object is masked from 'package:base':
lbeta
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] 0.3078410 0.86092958 0.5103373 0.5077035 0.5397299 0.5096365 0.67933234
[2,] 0.2566403 0.23240343 0.1378517 0.3029042 0.6542061 0.1426028 0.05568916
[3,] 0.3255349 0.24256378 0.6129738 0.5981926 0.3764897 0.2560481 0.42723168
[4,] 0.8158500 0.44259775 0.5230907 0.8136468 0.5397091 0.7121946 0.63126450
[5,] 0.2419351 0.24500077 0.1449628 0.4187859 0.4601780 0.1668369 0.10853685
[6,] 0.4161901 0.09544258 0.2006345 0.3656563 0.3695525 0.3164487 0.54889840
[,1] [,2]
[1,] 0.7571799 0.7228512
[2,] 0.2645595 0.1636609
[3,] 0.8488700 0.6953629
[4,] 0.6906420 0.3014912
[5,] 0.4588889 0.1628347
[6,] 0.2801068 0.6221602
$ll.max
[1] 742.7924
$theta
[1] 1.468476
$se
[1] 0.04745088
$converged
[1] TRUE
$fit
$fit$par
[1] 1.468476
$fit$objective
[1] -742.7924
$fit$convergence
[1] 0
$fit$iterations
[1] 6
$fit$evaluations
function gradient
7 9
$fit$message
[1] "relative convergence (4)"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.