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 included. 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 Cheers, Berwin ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel