[R] Individual log likelihoods of nlsList objects.
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Jul 1 22:34:27 CEST 2004
The function is logLik, not logLike! Try
 logLik.Arima* logLik.corStruct* logLik.glm*
 logLik.gls* logLik.glsStruct* logLik.gnls*
 logLik.gnlsStruct* logLik.lm* logLik.lme*
 logLik.lmeStruct* logLik.lmeStructInt* logLik.lmList*
 logLik.nls* logLik.reStruct* logLik.varComb*
Non-visible functions are asterisked
so logLik.nls is still being used.
On Thu, 1 Jul 2004, Ken Kelley wrote:
> I was wondering if the logLike.nls() and logLike.nlme() functions are still
> being used. Neither function seems to be available in the most recent
> release of R (1.9.1).
I suspect you don't understand how R looks for them. Have you read the
article on namespaces in R-News? Do you know what getAnywhere() does? The
"nls" method for function logLik is not necessarily the same thing as a
function logLik.nls, and even if it is, that function is not necessarily
visible to the user (as distinct to the function logLik).
> The following is contained in the help file for logLik(): "classes which
> already have methods for this function include: 'glm', 'lm', 'nls' and
> 'gls', 'lme' and others in package 'nlme'."
NB: NO mention of "nlme" fits.
> Thus, I was expecting that logLik.nls() and logLik.nlme() could be used
> for objects of the nls and nlme class, respectively.
Why do you expect so? It doesn't even mention the "nlme" class. There is
no logLik.nlme, and never was. (As nlme does not do exact ML fitting, it
is not going to be able to calculate a likelihood without doing
integration which it does not do. What nlme does is ML in a local linear
> Are these functions no longer needed because logLike() subsumes
> logLike.nls() and logLike.nlme() as special cases? Did/does
> logLike.nls() and logLike.nlme() have any advantages above and beyond
> logLike() when applying them to nls and nlme objects?
Please do read up about methods, method dispatch and namespaces.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help