[Rd] nobs() and logLik()

From: Berwin A Turlach <Berwin.Turlach_at_gmail.com>
Date: Fri, 20 Jan 2012 13:30:14 +0800

Dear all,

I am studying a bit the various support functions that exist for extracting information from fitted model objects.

>From the help files it is not completely clear to me whether the number returned by nobs() should be the same as the "nobs" attribute of the object returned by logLik().

If so, then there is a slight inconsistency in the methods for 'nls' objects with logLik.nls() taking zero weights into account while nobs.nls() does not. Admittedly, the help page of nobs() states that:

	For 'lm' and 'glm' fits, observations with zero weight are not

i.e. does not comment on what nls does.

But I wonder whether the following behaviour is desirable:

R> DNase1 <- subset(DNase, Run == 1)
R> fm3DNase2 <- nls(density ~ Asym/(1 + exp((xmid - log(conc))/scal)),

+         data = DNase1, weights=c(0,rep(1,14),0), 
+         start = list(Asym = 3, xmid = 0, scal = 1))
R> nobs(fm3DNase2)
[1] 16
> logLik(fm3DNase2)

'log Lik.' 42.62777 (df=4)
> nobs(logLik(fm3DNase2))

[1] 14



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Fri 20 Jan 2012 - 05:34:19 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 20 Jan 2012 - 06:50:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive