R/generalisedPareto.R
generalisedPareto.Rd
Functions involved in making inferences about the scale and shape parameters of a generalised Pareto distribution using maximum likelihood estimation.
A numeric vector of raw data. Missing values are removed using
na.omit
.
A numeric scalar. The extremal value threshold.
A fitted model object returned from fitGP()
.
Further arguments to be passed to the functions in the
sandwich package meat
(if cluster = NULL
),
or meatCL
(if cluster
is not
NULL
).
A numeric parameter vector of length 2 containing the values of the generalised Pareto scale and shape parameters.
A numeric vector of threshold excesses, that is, amounts
by which exceedances of u
exceed u
.
These control the estimation of the observed
information in gpObsInfo
when the GP shape parameter \(\xi\) is
very close to zero. In these cases, direct calculation is unreliable.
eps
is a (small, positive) numeric scalar. If the absolute value
of the input value of \(\xi\), that is, pars[2]
, is smaller than
eps
then we approximate the [2, 2]
element using a Taylor
series expansion in \(\xi\), evaluated up to and including the
m
th term.
fitGP
returns an object of class "GP"
, a list
with components: maxLogLik
, threshold
, mle
,
vcov
, exceedances
, nexc
,
where exceedances
is a vector containing the values that exceed the
threshold threshold
and nexc
is the length of this vector.
coef.GP
: a numeric vector of length 2 with names
c("sigma[u]", "xi")
. The MLEs of the GP parameters
\(\sigma_u\) and \(\xi\).
vcov.GP
: a \(2 \times 2\) matrix with row and
column names c("sigma[u]", "xi")
. The estimated
variance-covariance matrix for the model parameters. No adjustment for
cluster dependence has been made.
nobs.GP
: a numeric vector of length 1. The number of
observations used to estimate (\(\sigma_u\), \(\xi\)).
logLik.GP
: an object of class "logLik"
: a numeric scalar
with value equal to the maximised log-likelihood. The returned object
also has attributes nobs
, the numbers of observations used in
each of these model fits, and "df"
(degrees of freedom), which is
equal to the number of total number of parameters estimated (2).
gpObsInfo
returns a 2 by 2 matrix with row and columns names
c("sigma[u]", "xi")
.
fitGP
: fit a generalised Pareto distribution using maximum likelihood
estimation, using an independence log-likelihood formed by
summing contributions from individual observations. No adjustment for
cluster dependence has been made in estimating the variance-covariance
matrix stored as component in vcov
in the returned object. This
function calls grimshaw_gp_mle
.
coef
, vcov
, nobs
and logLik
methods are
provided for objects of class "GP"
returned from fitGP
.
gpObsInfo
: calculates the observed information matrix for a random
sample excesses
from the generalized Pareto distribution, that is,
the negated Hessian matrix of the generalized Pareto independence
log-likelihood, evaluated at pars
.
# Set up data and set a threshold
cdata <- c(exdex::cheeseboro)
# Fit a generalised Pareto distribution
fit <- fitGP(cdata, 45)
# Calculate the log-likelihood at the MLE
res <- logLikVector(fit)
# The logLik method sums the individual log-likelihood contributions.
logLik(res)
#> 'log Lik.' -642.3738 (df=2)
# nobs, coef, vcov, logLik methods for objects returned from fitGP()
nobs(fit)
#> [1] 205
coef(fit)
#> sigma[u] xi
#> 9.27393360 -0.09367672
vcov(fit)
#> sigma[u] xi
#> sigma[u] 0.73625550 -0.038388888
#> xi -0.03838889 0.003725287
logLik(fit)
#> 'log Lik.' -642.3738 (df=2)