Skip to content

Buglet/omission in nls package (PR#6901)

3 messages · Brian Ripley, Berwin A Turlach

#
Dear all,

I noticed the following under R 1.8.1 (when nls was still a separate
package) but the same problem occurs under R 1.9.0 (where most (all?)
of nls is now in the stats package):
NULL

The problem seems to be that summary.nls uses the name "parameters"
instead of the name "coefficients" for the matrix with the estimates,
standard errors, t values and p values:
Estimate  Std. Error   t value     Pr(>|t|)
b0 212.68370728 6.947153198 30.614512 3.241160e-11
b1   0.06412123 0.008280944  7.743227 1.565136e-05

Thus, coef.default fails on an object of class "summary.nls".

Possible fixes:
1) Rename that part of the summary.nls structure from parameters to
   coefficients  (not sure if that breaks something else); or
2) Write a coef.summary.nls method that returns the structure
   parameter from a summary.nls object passed to it.

Cheers,

        Berwin

--please do not edit the information below--

Version:
 platform = i686-pc-linux-gnu
 arch = i686
 os = linux-gnu
 system = i686, linux-gnu
 status = 
 major = 1
 minor = 9.0
 year = 2004
 month = 04
 day = 12
 language = R

Search Path:
 .GlobalEnv, package:methods, package:stats, package:graphics, package:utils, Autoloads, package:base
1 day later
#
Berwin,

No one has said the coef() will work on a summary object, but it would be 
nice if it did where appropriate.

I've added an summary.nls method for 2.0.0.

Brian
On Fri, 21 May 2004 berwin@maths.uwa.edu.au wrote:

            
`all of nls', indeed.

  
    
#
G'day Brian,
BDR> No one has said the coef() will work on a summary object,
But no one said that coef() will not work on a summary object either. :)

    BDR> but it would be nice if it did where appropriate.
Agreed, I looked up the help page and I think it is a bit ambiguous
about this point.  It starts off with:

   Description:
   
        'coef' is a generic function which extracts model coefficients
        from objects returned by modeling functions.  [...]

O.k., summary functions are not modeling functions, so one can argue
that one cannot expect coef() to work on summary objects.  But then
the help page continues and says:

   Arguments:
   
     object: an object for which the extraction of model coefficients is
             meaningful.

And I would argue that the extraction of model coefficients is indeed
meaningful for objects of class "summary.lm", "summary.nls",
"summary.glm" and probably a few others too. :)
OTOH, extracting model coefficient from an object of class
"summary.aov" is probably not meaningful....

    BDR> I've added an summary.nls method for 2.0.0.
Thanks!

Cheers,

        Berwin