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

From: Moshe Olshansky <m_olshansky_at_yahoo.com>
Date: Sun, 06 Jul 2008 18:21:09 -0700 (PDT)


This is correct for larger (more columns) matrices - computing the t(A)*A matrix and inverting it may cause numerical problems, but this should not be the case with two columns (one of which is all 1's).

In any case, the matrix depends on vector x only and since it is small (80 entries), the resulting matrix can be decomposed/processed in any desirable way independently of the huge Y matrices (but once again, this is not needed for the particular case).

> From: Rolf Turner <r.turner_at_auckland.ac.nz>
> Subject: Re: [R] Lots of huge matrices, for-loops, speed
> To: m_olshansky_at_yahoo.com
> Cc: r-help_at_r-project.org, "Zarza" <s.schmidtlein_at_uni-bonn.de>
> Received: Monday, 7 July, 2008, 9:40 AM
> 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 confidential. If you
> are not the
> intended recipient please delete the message and notify the
> sender.
> Any views or opinions presented are solely those of the
> author.
>
> This e-mail has been scanned and cleared by MailMarshal
> www.marshalsoftware.com
> ######################################################################



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 Mon 07 Jul 2008 - 01:27:58 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 - 01:32:36 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