[R] Lots of huge matrices, for-loops, speed

Rolf Turner r.turner at auckland.ac.nz
Mon Jul 7 01:40:15 CEST 2008


On 7/07/2008, at 11:05 AM, Moshe Olshansky wrote:

> Another possibility is to use explicit formula, i.e. if you are  
> doing linear regression like y = a*x + b then the explicit formulae  
> are:
>
> a = (meanXY - meanX*meanY)/(meanX2 - meanX^2)
> b = (meanY*meanX2 - meanX*meanXY)/(meanX2 - meanX^2)
>
> where meanX is mean(x), meanXY is mean(x*y), meanX2 is mean(x^2), etc.


My understanding is that such formulae, while ``algebraically  
correct'' are
highly unstable numerically and hence should be avoided.

Others who are wiser and more knowledgeable than I may wish to  
comment or
correct me.

	cheers,

		Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}



More information about the R-help mailing list