logLik {base} | R Documentation |
This function is generic; method functions can be written to handle
specific classes of objects. Classes which already have methods for
this function include: lm
, nls
in package nls,
and gls
, lme
and others in package nlme.
logLik(object, ...)
## S3 method for class 'logLik'
as.data.frame(x, row.names = NULL, optional = FALSE)
object |
any object from which a log-likelihood value, or a contribution to a log-likelihood value, can be extracted. |
... |
some methods for this generic function require additional arguments. |
x |
an object of class |
row.names , optional |
arguments to the |
Returns an object, say r
, of class logLik
which is a
number with attributes, attr(r, "df")
(degrees of
freedom) giving the number of parameters in the model.
There's a simple print
method for logLik
objects.
The details depend on the method function used; see the appropriate documentation.
Jose Pinheiro and Douglas Bates
logLik.lm
, logLik.nls
,
logLik.gls
, logLik.lme
, etc.
## see the method function documentation
x <- 1:5
lmx <- lm(x ~ 1)
logLik(lmx) # using print.logLik() method
str(logLik(lmx))