y <- matrix( rnorm(100 * 1000), ncol = 1000 )
x <- rnorm(100)
a <- mvbetas(y, x, pvalue = FALSE)
b <- matrix(nrow = 1000, ncol = 2)
z <- cbind(1, x)
for (i in 1:1000) b[i, ] = coef( lm.fit( z, y[, i] ) )
system.time( mvbetas(y, x) )
system.time( for (i in 1:1000) b[i, ] = coef( lm.fit( z, y[, i] ) ) )
Run the code above in your browser using DataLab