logLikVector {lite} | R Documentation |
Functions for log-likelihood contributions
Description
Generic function for calculating log-likelihood contributions from individual observations for a fitted model object.
Usage
logLikVector(object, ...)
## S3 method for class 'Bernoulli'
logLikVector(object, pars = NULL, ...)
## S3 method for class 'GP'
logLikVector(object, pars = NULL, ...)
## S3 method for class 'logLikVector'
logLik(object, ...)
Arguments
object |
A fitted model object. |
... |
Further arguments. None are used for either
|
pars |
A numeric parameter vector. For For |
Details
A logLikVector
method is used to construct a log-likelihood
function to supply as the argument loglik
to the function
adjust_loglik
, which performs log-likelihood
adjustment for parts 1 and 2 of the inferences performed by
flite
.
The logLik
method logLik.LogLikVector
sums the
log-likelihood contributions from individual observations.
Value
For logLikVector
: an object of class logLikVec
.
This is a numeric vector of length n
containing contributions to the
the independence log-likelihood from n
observations, with attributes
"df"
(degrees of freedom), giving the number of estimated
parameters in the model, and "nobs"
, giving the number observations
used to perform the estimation.
For logLik.logLikVector
: an object of class logLik
. This is
a number with the attributes "df"
and "nobs"
as described
above.
See Also
Bernoulli
for maximum likelihood inference for the
Bernoulli distribution.
generalisedPareto
for maximum likelihood inference
for the generalised Pareto distribution.
Examples
# logLikVector.Bernoulli
bfit <- fitBernoulli(c(exdex::cheeseboro) > 45)
bvec <- logLikVector(bfit)
head(bvec)
logLik(bvec)
logLik(bfit)
# estfun.generalisedPareto
gpfit <- fitGP(c(exdex::cheeseboro), u = 45)
gpvec <- logLikVector(gpfit)
head(gpvec)
logLik(gpvec)
logLik(gpfit)