View source: R/alogLik_methods.R
alogLik | R Documentation |
This function is generic. It performs adjustment of the loglikelihood
associated with fitted model objects, following Chandler and Bate (2007).
Certain classes of extreme value model objects are supported automatically.
For details see the alogLik
help pages for the packages:
evd
,
evir
,
extRemes
,
fExtremes
,
ismev
,
mev
,
POT
,
texmex
.
User-supplied objects can also be supported: the requirements for these
objects are explained in Details.
alogLik(
x,
cluster = NULL,
use_vcov = TRUE,
binom = FALSE,
k,
inc_cens = TRUE,
...
)
x |
A fitted model object with certain associated S3 methods. See Details. |
cluster |
A vector or factor indicating from which cluster the
respective log-likelihood contributions from If |
use_vcov |
A logical scalar. Should we use the |
binom |
A logical scalar. This option is only relevant to
GP models and is only available in the stationary
(no covariates) case. If |
k |
A non-negative integer scalar. This option is only relevant to
GP models and is only available in the stationary
(no covariates) case. If |
inc_cens |
A logical scalar. This argument is only relevant if
|
... |
Further arguments to be passed to the functions in the
sandwich package |
Object x
must have the following S3
methods:
logLikVec
: returns a vector of the contributions to the
independence loglikelihood from individual observations;
coef
: returns a vector of model coefficients, see
coef
;
nobs
: returns the number of (non-missing) observations
used in a model fit, see nobs
;
and may have the following S3 methods
vcov
: returns the estimated variance-covariance matrix of
the (main) parameters of a fitted model, see
vcov
;
estfun
: returns an n
by k
matrix, in which each
column gives the derivative of the loglikelihood at each of n
observation with respect to the k
parameters of the model, see
estfun
.
Loglikelihood adjustment is performed using the
adjust_loglik
function in the
chandwich
package.
The relevant arguments to adjust_loglik
, namely
loglik, mle, H
and V
, are created based on the class of
the object x
.
If a vcov
method is not available, or if use_vcov = FALSE
,
then the variance-covariance matrix of the MLE (from which H
is
calculated) is estimated inside adjust_loglik
using optimHess
.
The sandwich
package is used to estimate the variance matrix
V
of the score vector: meat
is used if
cluster = NULL
; meatCL
is used if
cluster
is not NULL
.
If cluster
is NULL
then any arguments of
meatCL
present in ... will be ignored.
Similarly, if cluster
is not NULL
then any arguments of
meat
present in ... will be ignored.
meat
and meatCL
require an estfun
method to be available, which,
in the current context, provides matrix of score contributions.
If a bespoke estfun
method is not provided then this is constructed
by estimating the score contributions using jacobian
.
An object inheriting from class "chandwich"
. See
adjust_loglik
.
The original fitted model object is available as an attribute named
"original_fit"
, accessible using attr(name, "original_fit")
,
where name
is the name of the object to which the object returned
from alogLik
is assigned.
If binom = TRUE
then the returned object has an extra attribute
named pu_aloglik
that contains an object inheriting from class
"chandwich"
relating specifically to inferences about the
probability of threshold exceedance. Also, the 4th component of the class
of the returned object becomes "bin-gpd"
.
If k
is supplied then the returned object has an extra attribute
named theta
that contains an object inheriting from class
c("kgaps", "exdex")
relating specifically to inferences about the
extremal index \theta
. See the Value section in
kgaps
.
If x
is one of the supported models then the class of the returned
object is a vector of length 5. The first 3 components are
c("lax", "chandwich", "name_of_package")
, where
"name_of_package"
is the name of the package from which the input
object x
originated. The remaining 2 components depend on the
model that was fitted. See the documentation of the relevant package
for details:
evd
,
evir
,
extRemes
,
fExtremes
,
ismev
,
mev
,
POT
,
texmex
.
Otherwise, the class of the returned object is
c("lax", "chandwich", class(x))
.
Objects returned from 'aloglik' have 'anova', 'coef', 'confint', 'logLik', 'nobs', 'plot', 'print', 'summary' and 'vcov' methods.
See the (package-specific) examples in evd
,
evir
, extRemes
,fExtremes
,
ismev
, mev
, POT
and
texmex
.
Chandler, R. E. and Bate, S. (2007). Inference for clustered data using the independence loglikelihood. Biometrika, 94(1), 167-183. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1093/biomet/asm015")}
Suveges, M. and Davison, A. C. (2010) Model misspecification in peaks over threshold analysis, The Annals of Applied Statistics, 4(1), 203-221. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1214/09-AOAS292")}
Zeileis (2006) Object-Oriented Computation and Sandwich Estimators. Journal of Statistical Software, 16, 1-16. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v016.i09")}
summary.chandwich
,
plot.chandwich
,
confint.chandwich
,
anova.chandwich
,
coef.chandwich
,
vcov.chandwich
and logLik.chandwich
for S3 methods for objects of class "chandwich"
.
conf_region
for confidence regions for
pairs of parameters.
adjust_loglik
in the chandwich
package to adjust a user-supplied loglikelihood.
meat
and
meatCL
in the sandwich package.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.