Re: [R] Individual log likelihoods of nlsList objects.

From: Martin Maechler <>
Date: Fri 02 Jul 2004 - 07:12:31 EST

>>>>> "Ken" == Ken Kelley <>
>>>>> on Thu, 1 Jul 2004 14:23:16 -0500 writes:

    Ken> Hello all.
    Ken> I was wondering if the logLike.nls() and logLike.nlme() functions are still
    Ken> being used. 

no, but the correctly spelled ones, logLik.nls and logLik.nlme are

    Ken> Neither function seems to be available in the most recent     Ken> release of R (1.9.1).

how do you know?

    Ken> The following is contained in the help file for
    Ken> logLik(): "classes which already have methods for this
    Ken> function include: 'glm', 'lm', 'nls' and 'gls', 'lme'
    Ken> and others in package 'nlme'." 

Hence do rather believe the documentation ....

    Ken> Thus, I was expecting
    Ken> that logLik.nls() and logLik.nlme() could be used for
    Ken> objects of the nls and nlme class, respectively. 

They *are* used whenever you (or your code indirectly) call logLik(.) on "nls" or "nlme" objects respectively.

You were never to call these directly, and you this has been discouraged a bit more as a side effect of the introduction of name spaces for all "core" and recommended (and quite a few more CRAN and bioconductor) packages.

You definitely need to learn about Classes and Methods ("S3" in this case) in R {or the S language in general}, and read the article about "Namespaces" in R-news, or (more technical), Luke Tierney's pages on this.

If you want to see them use, e.g.,


    Ken> Are these functions no longer needed because logLike()
    Ken> subsumes logLike.nls() and logLike.nlme() as special
    Ken> cases? Did/does logLike.nls() and logLike.nlme() have
    Ken> any advantages above and beyond logLike() when applying
    Ken> them to nls and nlme objects?

    Ken> On a related note, is there a way to get the log likelihoods of each     Ken> individual from an nlsList object?

    Ken> On p. 349 of Pinheiro and Bates (2000) the logLik() function is said to give
    Ken> the sum of the individual nls log-likelihoods. However,
    Ken> logLike(some.nlsList.object) does not work for me (even when there are no
    Ken> NAs). Any ideas?

if you are insisting on typo-ing you will have more problems with all versions of S ;-)
or did you try logLik( <...> ) ?

In any case use, (small) reproducible examples for these. Have you read the posting guide, mentioned at the tail of this message?

Martin mailing list PLEASE do read the posting guide! Received on Fri Jul 02 07:15:58 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:54:39 EST