[R] lm with data=(means,sds,ns)

(Ted Harding) Ted.Harding at nessie.mcc.ac.uk
Sun Apr 18 14:52:02 CEST 2004


On 18-Apr-04 Peter Dalgaard wrote:
> (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk> writes:
>> On 18-Apr-04 Prof Brian Ripley wrote:
>> > The short answer is no, as there is no way to recover the fitted
>> > values
>> 
>> Well, the fitted values (a + b*x_i) would be available, as would be
>> the estimates and SEs of coefficients, sums of squares, and relevant
>> F ratios and P values.
> 
> Not quite. You can get the estimates and per-group fitted values
> alright from a weighted regression, but the SEs require that you have
> the residual sum of squares and the within-group part of the SS is not
> obtainable, although trivially computable as sum(s^2*(n-1))

By "available" I did mean "computable" even if not explicitly present
in the implementation of 'lm'. Sorry if not clear!

> (I did go through some of this for the trypsin example in Ch 10.4 in
> ISwR)  

This looks more and more like a book I should get hold of ...

>> Anyway, I'm grateful to know what the position is. At least I can now
>> feel happy about having to roll up my sleeves and get stuck in the
>> hard way.
> 
> Actually, I susppect that it's only about half an hour's work:
> 
> 1) The constructor returns (with class lmG or so)
>    list(wlm=lm(y~formula,weights=n), withinSS=sum(s^2*(n-1)),
>         withinDF=sum(n-1))  
> 
> 2) summary.lmG is like summary.lm except that resvar adds in the
>    withinSS and withinDF. Likewise anova and predict methods.
> 
> 3) done

Hmm ... makes it look sublimely simple!

Thanks a lot for the comments and pointers.
Best wishes,
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 18-Apr-04                                       Time: 13:52:02
------------------------------ XFMail ------------------------------




More information about the R-help mailing list