[R] Coefficients from LM

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Sep 16 11:34:38 CEST 2005


On Fri, 16 Sep 2005, Dieter Menne wrote:

> Charles Annis, P.E. <Charles.Annis <at> StatisticalEngineering.com> writes:
>
>> Here's an example with a glm; lm() works the same way but has fewer internal
>> objects.
>>
>> mod3 <- glm(tree ~ altitude, family = binomial)
>>
>> You can use names() to find out what's inside:
>>
>>> names(mod3)
>>  [1] "coefficients"      "residuals"         "fitted.values"     "effects"
>
> You get more information about the internals by using str(mod3) instead of names
> (mod3).

Well, yes for a specific object but not for what the function returns in 
general and what it means. In this case (and most others), the help page 
is the best source of information about the return value.

However, in general it is best to use the supplied accessor functions such 
as coef() and residuals(), and these are covered in the introductory 
accounts of model fitting in S/R.

-- 
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 mailing list