logLik
Extract Log-Likelihood

Description

A group of generic functions used to extract the Log-Likelihood value of a fitted class or model.

Usage

logLik(object, ...)
## S3 method for class 'logLik':
print(x, digits = getOption("digits"), ...)
## S3 method for class 'logLik':
logLik(object, ...)
## S3 method for class 'lm':
logLik(object, REML = FALSE, ...)
## S3 method for class 'nls':
logLik(object, REML = FALSE)
## S3 method for class 'logLik':
str(object, digits = max(2, getOption("digits") - 3),
        vec.len = getOption("str")$vec.len, ...)

Arguments

object an object inheriting from a fitted model or a class, which has the log-likelihood value to be extracted.
... other arguments to pass in or from other functions.
REML a logical flag. Optional. If TRUE, the restricted log-likelihood is returned. If FALSE (the default), the log-likelihood is returned.

logLik.nls cannot compute the restricted log-likelihood and gives an error if you ask for it.

k a numeric value. Used as the coefficient for the number of parameters in the fitted model.
digits the maximum number of (significant) digits. The default is the value of the system option "digits".
vec.len the non-negative integer number of values in object. (Optionally, it can be coercible to a non-negative integer.)

The default value is the "vec.len" component of the option "str".

Details

str.logLik is represented with ... if vec.len is less than length of object.
Value
returns an object of class "logLik" containing the log likelihood value along with the attributes nobs and df, which represent the number of observations and degrees of freedom from the model.
logLik.logLik returns object.
References
For logLik.lm:
Harville, D.A. 1974. Bayesian inference for variance components using only error contrasts. Biometrika. Volume 61. 383-385.
See Also
lm, nls, glm,
Examples
m1 <- lm(ozone ~ radiation + temperature, data = Sdatasets::air)
logLik(m1)
## 'log Lik.' -91.68577 (df=4)
logLik(m1, REML = TRUE)
## 'log Lik.' -104.4643 (df=4)













Package stats version 6.0.0-69
Package Index