depmeasures {tsxtreme} | R Documentation |
Estimate dependence measures
Description
Appropriate marginal transforms are done before the fit using standard procedures, before the dependence model is fitted to the data. Then the posterior distribution of a measure of dependence is derived. thetafit
gives posterior samples for the extremal index \theta(x,m)
and chifit
does the same for the coefficient of extremal dependence \chi_m(x)
.
Usage
thetafit(ts, lapl = FALSE, nlag = 1,
R = 1000, S = 500,
u.mar = 0, u.dep,
probs = seq(u.dep, 0.9999, length.out = 30),
method.mar = c("mle", "mom","pwm"), method = c("prop", "MCi"),
silent = FALSE,
fit = TRUE, prev.fit=bayesfit(), par = bayesparams(),
submodel = c("fom", "none"), levels=c(.025,.975))
chifit(ts, lapl = FALSE, nlag = 1,
R = 1000, S = 500,
u.mar = 0, u.dep,
probs = seq(u.dep, 0.9999, length.out = 30),
method.mar = c("mle", "mom","pwm"), method = c("prop", "MCi"),
silent = FALSE,
fit = TRUE, prev.fit=bayesfit(), par = bayesparams(),
submodel = c("fom", "none"), levels=c(.025,.975))
Arguments
ts |
a vector, the time series for which to estimate the extremal index |
lapl |
logical; |
nlag |
the run-length; an integer larger or equal to 1. |
R |
the number of samples per MCMC iteration drawn from the sampled posterior distributions; used for the estimation of the dependence measure. |
S |
the number of posterior distributions sampled to be used for the estimation of the dependence measure. |
u.mar |
probability; threshold used for marginal transformation if |
u.dep |
probability; threshold used for the extremal dependence model. |
probs |
vector of probabilities; the values of |
method.mar |
a character string defining the method used to estimate the marginal GPD; either |
method |
a character string defining the method used to estimate the dependence measure; either |
silent |
logical ( |
fit |
logical; |
prev.fit |
an object of class 'bayesfit'. Needed if |
par |
an object of class ' |
submodel |
a character string, either |
levels |
vector of probabilites; the quantiles of the posterior distribution of the extremal measure to be computed. |
Details
The sub-asymptotic extremal index is defined as
\theta(x,m) = Pr(X_1 < x,\ldots,X_m < x | X_0 > x),
whose limit as x
and m
go to \infty
appropriately is the extremal index \theta
. The extremal index can be interpreted as the inverse of the asymptotic mean cluster size (see thetaruns)
.
The sub-asymptotic coefficient of extremal dependence is
\chi_m(x) = Pr(X_m > x | X_0 > x),
whose limit \chi
defines asymptotic dependence (\chi > 0
) or asymptotic independence (\chi = 0
).
Both types of extremal dependence measures can be estimated either using a
* proportion method (method == "prop"
), sampling from the conditional probability given X_0 > x
and counting the proportion of sampled points falling in the region of interest, or
* Monte Carlo integration (method == "MCi"
), sampling replicates from the marginal exponential tail distribution and evaluating the conditional tail distribution in these replicates, then taking their mean as an approximation of the integral.
submodel == "fom"
imposes a first order Markov structure to the model, namely a geometrical decrease in \alpha
and a constant \beta
across lags, i.e. \alpha_j = \alpha^j
and \beta_j = \beta
, j=1,\ldots,m
.
Value
An object of class 'depmeasure', containing a subset of:
bayesfit |
An object of class 'bayesfit' |
theta |
An array with dimensions |
distr |
An array with dimensions |
chi |
An array with dimensions |
probs |
|
levels |
|
See Also
Examples
## generate data from an AR(1)
## with Gaussian marginal distribution
n <- 10000
dep <- 0.5
ar <- numeric(n)
ar[1] <- rnorm(1)
for(i in 2:n)
ar[i] <- rnorm(1, mean=dep*ar[i-1], sd=1-dep^2)
plot(ar, type="l")
plot(density(ar))
grid <- seq(-3,3,0.01)
lines(grid, dnorm(grid), col="blue")
## rescale the margin (focus on dependence)
ar <- qlapl(pnorm(ar))
## fit the data
params <- bayesparams()
params$maxit <- 100 # bigger numbers would be
params$burn <- 10 # more sensible...
params$thin <- 4
theta <- thetafit(ts=ar, R=500, S=100, u.mar=0.95, u.dep=0.98,
probs = c(0.98, 0.999), par=params)
## or, same thing in two steps to control fit output before computing theta:
fit <- depfit(ts=ar, u.mar=0.95, u.dep=0.98, par=params)
plot(fit)
theta <- thetafit(ts=ar, R=500, S=100, u.mar=0.95, u.dep=0.98,
probs = c(0.98, 0.999), fit=FALSE, prev.fit=fit)