Learn R Programming

tsxtreme (version 0.3.4)

dep2fit: Dependence model fit (stepwise)

Description

The conditional Heffernan--Tawn model is used to fit the dependence in time of a stationary series. A standard 2-stage procedure is used.

Usage

dep2fit(ts, u.mar = 0, u.dep,
        lapl = FALSE, method.mar = c("mle","mom","pwm"),
        nlag = 1, conditions = TRUE)

Value

alpha

parameter controlling the conditional extremal expectation.

beta

parameter controlling the conditional extremal expectation and variance.

res

empirical residual of the model.

pars.se

vector of length 2 giving the estimated standard errors for alpha and beta given by the hessian matrix of the likelihood function used in the first step of the inference procedure.

Arguments

ts

numeric vector; time series to be fitted.

u.mar

marginal threshold; used when transforming the time series to Laplace scale.

u.dep

dependence threshold; level above which the dependence is modelled. u.dep can be lower than u.mar.

lapl

logical; is ts on the Laplace scale already? The default (FALSE) assumes unknown marginal distribution.

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. Defaults to "mle".

nlag

integer; number of lags to be considered when modelling the dependence in time.

conditions

logical; should conditions on \(\alpha\) and \(\beta\) be set? (see Details) Defaults to TRUE.

Details

Consider a stationary time series \((X_t)\) with Laplace marginal distribution; the fitting procedure consists of fitting $$X_t = \alpha_t\times x_0 + x_0^{\beta_t}\times Z_t,\quad t=1,\ldots,m,$$ with \(m\) the number of lags considered. A likelihood is maximised assuming \(Z_t\sim N(\mu_t, \sigma^2_t)\), then an empirical distribution for the \(Z_t\) is derived using the estimates of \(\alpha_t\) and \(\beta_t\) and the relation $$\hat Z_t = \frac{X_t - \hat\alpha_t\times x_0}{x_0^{\hat\beta_t}}.$$

conditions implements additional conditions suggested by Keef, Papastathopoulos and Tawn (2013) on the ordering of conditional quantiles. These conditions help with getting a consistent fit by shrinking the domain in which \((\alpha,\beta)\) live.

See Also

depfit, theta2fit

Examples

Run this code
## 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 margin
ar <- qlapl(pnorm(ar))

## fit model without constraints...
fit1 <- dep2fit(ts=ar, u.mar = 0.95, u.dep=0.98, conditions=FALSE)
fit1$a; fit1$b

## ...and compare with a fit with constraints
fit2 <- dep2fit(ts=ar, u.mar = 0.95, u.dep=0.98, conditions=TRUE)
fit2$a; fit2$b# should be similar, as true parameters lie well within the constraints

Run the code above in your browser using DataLab