[R] question regarding lm and logLik in R
Martin Maechler
maechler at stat.math.ethz.ch
Sat Sep 28 16:01:39 CEST 2002
>>>>> "DeanneW" == Wright, Deanne <deanne.wright at pioneer.com>
>>>>> on Fri, 27 Sep 2002 16:43:09 -0500 writes:
DeanneW> It appears that the degrees of freedom reported by
DeanneW> logLik changed between R 1.4.1 and R 1.5.1. Is
DeanneW> this true?
yes, a bug fix, see below.
DeanneW> Detail:
>> I have been using the lm and logLik functions in R to
>> develop code using version 1.4.1. When I run it on
>> version 1.5.1, I'm getting different degrees of freedom
>> with the logLik function. Version 1.5.1 seems to give
>> one extra degree of freedom than version 1.4.1. As long
>> as this is consistent, it is not a problem for me since
>> I'm doing likelihood ratio tests, using differences in
>> the degrees of freedom. However, I wanted to make sure
>> that the degrees of freedom will be correct before I
>> proceed.
>>
>> The data set I am using has 1000 observations. Both
>> version 1.4.1 and version 1.5.1 give 930 degrees of
>> freedom for the residual using the anova function (which
>> also agrees with SAS), but version 1.4.1 returns 70
>> degrees of freedom with logLik, while version 1.5.1
>> returns 71 degrees of freedom. All of the other output
>> seems to be the same.
>>
DeanneW> One person suggested that version 1.5 might include
DeanneW> estimation of the residual variance into the model
DeanneW> parameters. Does anyone know if a) this is the
this is at least the change that was in the release news for
1.5.0, i.e. also in the "NEWS" file under "BUG FIXES",
and there, just below, is another one affecting glm()s only :
o logLik.lm() now uses "df = p + 1" again (`+ sigma'!).
o logLik.glm() was incorrect for families with estimated
dispersion.
DeanneW> only change or if there is somewhere I can read
DeanneW> about how the degrees of freedom are calculated?
DeanneW> b) the degrees of freedom in 1.5.1 are correct for
DeanneW> using in differences for LRTs?
yes, if you compare models that are "nested"
Regards,
Martin Maechler <maechler at stat.math.ethz.ch> http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1228 <><
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list