It appears that the degrees of freedom reported by logLik changed between R 1.4.1 and R 1.5.1. Is this true? 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. >One person suggested that version 1.5 might include estimation of the residual variance into the model parameters. Does anyone know if a) this is the only change or if there is somewhere I can read about how the degrees of freedom are calculated? b) the degrees of freedom in 1.5.1 are correct for using in differences for LRTs?> Thanks very much for you consideration, > Deanne Wright > Deanne.Wright at pioneer.com > > >This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under applicable law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-mail and delete this e-mail from your system. Unless explicitly and conspicuously designated as "E-Contract Intended", this e-mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-mail does not constitute a consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties. Francais Deutsch Italiano Espanol Portuges Japanese Chinese Korean http://www.DuPont.com/corp/email_disclaimer.html -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>>>>> "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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Fri, 27 Sep 2002, Wright, Deanne wrote:> One person suggested that version 1.5 might include estimation of the > residual variance into the model parameters. Does anyone know if > a) this is the only change or if there is somewhere I can read about how the > degrees of freedom are calculated? > b) the degrees of freedom in 1.5.1 are correct for using in differences for > LRTs?The degrees of freedom do include the residual variance -- this is clear if you look at the code for logLik.glm, where an extra df is added for families that have a scale parameter but not otherwise. The only real place to find how the variance is calculated is in the methods for the logLik function: logLik.lm, logLik.glm. You should be able to rely on the df being right for likelihood ratio tests, since that's the point of having them. -thomas -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._