Processing math: 100%

Generic function for calculating log-likelihood contributions from individual observations for a fitted model object.

logLikVector(object, ...)

# S3 method for Bernoulli
logLikVector(object, pars = NULL, ...)

# S3 method for GP
logLikVector(object, pars = NULL, ...)

# S3 method for logLikVector
logLik(object, ...)

Arguments

object

A fitted model object.

...

Further arguments. None are used for either logLikVector.Bernoulli or
logLikVector.GP.

pars

A numeric parameter vector.

For logLikVector.Bernoulli this is a vector of length 1 containing a value of the Bernoulli success probability.

For logLikVector.GP this is a numeric vector of length 2 containing the values of the generalised Pareto scale (σu) and shape (ξ) parameters.

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.

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.

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)
#> [1] -0.02810136 -0.02810136 -0.02810136 -0.02810136 -0.02810136 -0.02810136
logLik(bvec)
#> 'log Lik.' -937.2539 (df=1)
logLik(bfit)
#> 'log Lik.' -937.2539 (df=1)

# estfun.generalisedPareto
gpfit <- fitGP(c(exdex::cheeseboro), u = 45)
gpvec <- logLikVector(gpfit)
head(gpvec)
#> [1] -2.626236 -2.424665 -2.524926 -2.626236 -3.149341 -2.524926
logLik(gpvec)
#> 'log Lik.' -642.3738 (df=2)
logLik(gpfit)
#> 'log Lik.' -642.3738 (df=2)