[R] SLOW split() function

Thomas Lumley tlumley at uw.edu
Tue Oct 11 21:11:15 CEST 2011


On Wed, Oct 12, 2011 at 4:56 AM, ivo welch <ivo.welch at gmail.com> wrote:
> thanks, josh.  in my posting example, I did not need anything except
> coefficients.  (when this is the case, I usually do not even use
> lm.fit, but I eliminate all missing obs first and then use solve
> crossprod(y,cbind(1,x)) crossprod(cbind(1,x)).)  this is pretty fast.)

solve(cbind(1,x), y) should be even faster, and more numerically stable,
 [and less likely to make certain people want to cast you into the
outer darkness, where there is SAS and gnashing of teeth]

> alas, I will need to figure how to get coef standard errors faster in
> this case.  summary.lm() is really slow.

The code from summary.lm that actually computes the standard errors is
fairly efficient; you could extract that.

   -thomas

-- 
Thomas Lumley
Professor of Biostatistics
University of Auckland



More information about the R-help mailing list