Re: [R] efficient use of lm over a matrix vs. using apply over rows

2011-08-13 Thread darius
Good Bless you Duncan. Your explanation is crisp and to the point. Thank you. -- View this message in context: http://r.789695.n4.nabble.com/efficient-use-of-lm-over-a-matrix-vs-using-apply-over-rows-tp870810p3742058.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] efficient use of lm over a matrix vs. using apply over rows

2011-08-13 Thread darius
Good Bless you Duncan. Your explanation is crisp and to the point. Thank you. -- View this message in context: http://r.789695.n4.nabble.com/efficient-use-of-lm-over-a-matrix-vs-using-apply-over-rows-tp870810p3742043.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] efficient use of lm over a matrix vs. using apply over rows

2008-10-05 Thread Gabor Grothendieck
In that case, using the example data from the prior response all you need is: coef(lm(t(mat) ~ x)) On Sun, Oct 5, 2008 at 1:18 PM, Mark Kimpel <[EMAIL PROTECTED]> wrote: > Sorry for the vagueness of my question, your interpretation, however, was > spot on. Correct me if I am wrong, but my impres

Re: [R] efficient use of lm over a matrix vs. using apply over rows

2008-10-05 Thread Gabor Grothendieck
Sorry, I missed the fact that Duncan had this solution as well at the end of his response. On Sun, Oct 5, 2008 at 1:31 PM, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > In that case, using the example data from the prior response all you need > is: > > coef(lm(t(mat) ~ x)) > > > On Sun, Oct 5, 2

Re: [R] efficient use of lm over a matrix vs. using apply over rows

2008-10-05 Thread Mark Kimpel
Sorry for the vagueness of my question, your interpretation, however, was spot on. Correct me if I am wrong, but my impression is that apply is a more compact way of a for loop, but that the way R handles them computationally are the same. In the article I seem to remember, there was a significant

Re: [R] efficient use of lm over a matrix vs. using apply over rows

2008-10-05 Thread Duncan Murdoch
On 05/10/2008 10:08 AM, Mark Kimpel wrote: I have a large matrix, each row of which needs lm applied. I am certain than I read an article in R-news about this within the last year or two that discussed the application of lm to matrices but I'll be darned if I can find it with Google. Probably usi

[R] efficient use of lm over a matrix vs. using apply over rows

2008-10-05 Thread Mark Kimpel
I have a large matrix, each row of which needs lm applied. I am certain than I read an article in R-news about this within the last year or two that discussed the application of lm to matrices but I'll be darned if I can find it with Google. Probably using the wrong search terms. Can someone steer