[R] {Spam?} Re: linear model coefficients by year and industry, fitted values, residuals, panel data

Peter Ehlers ehlers at ucalgary.ca
Wed Apr 3 21:18:48 CEST 2013


On 2013-04-03 11:54, Adams, Jean wrote:
> Peter.
>
> For suggestion 1, what advantages are there to using coef() rather than
> $coef?

Not much difference for lm models, but note that it does use the
partial matching 'feature' of the '$' extractor, since the component
name is actually 'coefficients'.

But try it for an nls model. Mynlsmodel$coefficients won't work (well,
it won't give an error but it will yield NULL).

That's why there are special extractor functions such as coef.nls,
coef.Arima, etc. For lm models, coef.default is used.

Peter Ehlers

>
> For suggestion 2, thanks!  I'm new to the plyr package and wasn't aware
> of the mutate() function.
>
> Jean
>

  [...snip...]



More information about the R-help mailing list