et2fit: Fit time series extremes In tsxtreme: Bayesian Modelling of Extremal Dependence in Time Series

Description

Appropriate marginal transforms are done before the fit using standard procedures, before the dependence model is fitted to the data. Then the measure of dependence θ(x,m) is derived using a method described in Eastoe and Tawn (2012).

Usage

 ```1 2 3 4 5``` ```theta2fit(ts, lapl = FALSE, nlag = 1, R = 1000, 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, R.boot = 0, block.length = m * 5, levels = c(.025,.975)) ```

Arguments

 `ts` numeric vector; time series to be fitted. `lapl` logical; is `ts` on the Laplace scale already? The default (FALSE) assumes unknown marginal distribution. `nlag` integer; number of lags to be considered when modelling the dependence in time. `R` integer; the number of samples used for estimating θ(x,m). `u.mar` marginal threshold; used when transforming the time series to Laplace scale if `lapl` is FALSE; not used otherwise. `u.dep` dependence threshold; level above which the dependence is modelled. `u.dep` can be lower than `u.mar`. `probs` vector of probabilities; the values of x for which to evaluate θ(x,m). `method.mar` a character string defining the method used to estimate the marginal GPD; either `"mle"` for maximum likelihood of `"mom"` for method of moments or `"pwm"` for probability weighted moments methods. Defaults to `"mle"`. `method` a character string defining the method used to estimate the dependence measure; either `"prop"` for proportions or `"MCi"` for Monte Carlo integration (see Details). `silent` logical (`FALSE`); verbosity. `R.boot` integer; the number of samples used for the block bootstrap for the confidence intervals. `block.length` integer; the block length used for the block-bootstrapped confidence intervals. `levels` vector of probabilities; the quantiles of the bootstrap distribution of the extremal measure to be computed.

Details

The standard procedure (`method="prop"`) to estimating probabilities from a Heffernan-Tawn fit best illustrated in the bivariate context (Y | X > u):

1. sample X from an exponential distribution above v ≥ u,

2. sample Z (residuals) from their empirical distribution,

3. compute Y using the relation Y = α * X + X^β * Z,

4. estimate Pr(X > v_x, Y > v_y) by calculating the proportion p of Y samples above v_y and multiply p with the marginal survival distribution evaluated at v_x.

With `method="MCi"` a Monte Carlo integration approach is used, where the survivor distribution of Z is evaluated at pseudo-residuals of the form

(v_y - α * X)/X^β,

where X is sampled from an exponential distribution above v_x. Taking the mean of these survival probabilities, we get the Monte Carlo equivalent of p in the proportion approach.

Value

List containing:

 `depfit ` an object of class 'stepfit' `probs ` `probs` `levels ` `probs` transformed to original scale of `ts` `theta ` a matrix with proportion or Monte Carlo estimates of θ(x,m). Rows correspond to values in `probs`, columns are point estimates and bootstrap quantiles

`dep2fit`, `thetafit`, `thetaruns`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22``` ```## 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 fit <- theta2fit(ts=ar, u.mar=0.95, u.dep=0.98) ## plot theta(x,1) plot(fit) abline(h=1, lty="dotted") ```