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

Peter Dalgaard p.dalgaard at biostat.ku.dk
Sun Apr 18 13:26:07 CEST 2004

Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:

> The short answer is no, as there is no way to recover the fitted values 
> and residuals so you can't get a proper fit object of class "lm" (and 
> hence get `summaries and all').
> Your pseudo-data method needs to fix the u_i to be mean zero, variance 
> one in the sample.  

That's what he did, no? A slightly more readable version is

 m + s*scale(rnorm(n))

> That is probably the quickest method.  The elegant one 
> is to create a new class "groupedlm" and write a constructor etc for it 
> ....

However, it begs the question whether it wouldn't have been better to
design the RSS into the lm class rather than computing it from
residuals in summary.lm and anova.lm and predict.lm and...

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907

More information about the R-help mailing list