> system.time( lm( t(y) ~ x ) )
user system elapsed
0.008 0.000 0.010
On Wed, 19 Sep 2007,
[EMAIL PROTECTED] wrote:
> Folks,
>
> I have a 3000 x 4 matrix (y), which I need to regress row-by-row against a
> 4-vector (x) to create a
> matrix lm.y of intercepts and slopes. To illust
[EMAIL PROTECTED] wrote:
> Folks,
>
> I have a 3000 x 4 matrix (y), which I need to regress row-by-row against a
> 4-vector (x) to create a
> matrix lm.y of intercepts and slopes. To illustrate:
>
> y <- matrix(rnorm(12000), ncol = 4)
> x <- c(1/12, 3/12, 6/12, 1)
>
> system.time(lm.y <- t(appl
[EMAIL PROTECTED] said the following on 9/19/2007 9:50 AM:
> Folks,
>
> I have a 3000 x 4 matrix (y), which I need to regress row-by-row against a
> 4-vector (x) to create a
> matrix lm.y of intercepts and slopes. To illustrate:
>
> y <- matrix(rnorm(12000), ncol = 4)
> x <- c(1/12, 3/12, 6/12,
Folks,
I have a 3000 x 4 matrix (y), which I need to regress row-by-row against a
4-vector (x) to create a
matrix lm.y of intercepts and slopes. To illustrate:
y <- matrix(rnorm(12000), ncol = 4)
x <- c(1/12, 3/12, 6/12, 1)
system.time(lm.y <- t(apply(y, 1, function(z) lm(z ~ x)$coefficient)))
4 matches
Mail list logo