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

From: Rolf Turner <r.turner_at_auckland.ac.nz>
Date: Mon, 07 Jul 2008 11:40:15 +1200

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}}

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun 06 Jul 2008 - 23:58:47 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 07 Jul 2008 - 02:32:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive