logLik.lm {base} | R Documentation |
If REML=FALSE
, returns the log-likelihood value of the linear
model represented by object
evaluated at the estimated
coefficients; else, the restricted log-likelihood evaluated at the
estimated coefficients is returned.
## S3 method for class 'lm'
logLik(object, REML = FALSE, ...)
object |
an object inheriting from class |
REML |
an optional logical value. If |
... |
further arguments to be passed to or from methods. |
an object of class logLik
,
the (restricted) log-likelihood of the linear model represented by
object
evaluated at the estimated coefficients. Note that
error variance \sigma^2
is estimated in lm()
and hence
counted as well.
Jose Pinheiro and Douglas Bates
Harville, D.A. (1974). Bayesian Inference for Variance Components Using Only Error Contrasts. Biometrika, 61, 383–385.
lm
data(attitude)
(fm1 <- lm(rating ~ ., data = attitude))
logLik(fm1)
logLik(fm1, REML = TRUE)
Nnlme <- is.na(match("package:nlme", search()))
if(require(nlme)) {
data(Orthodont)
fm1 <- lm(distance ~ Sex * age, Orthodont)
print(logLik(fm1))
print(logLik(fm1, REML = TRUE))
if(Nnlme) detach( "package:nlme")
}