I've done a lot of research on this very topic and found a few solutions. But
all the ways I've discovered involve loops.

Applying it to what you want, the best way I've found is to do (stolen from
an experienced R user, of course):

y<-array(rnorm(100),dim=c(10,10))
x<-array(rnorm(100),dim=c(10,10))

regg<-list()
for(i in 1:ncol(y))
 {
 regg[[i]]<-lm(y[,i]~x[,i])
 }

Now the reason I've stuck onto the list() method is because the output is
still in lm() format. So you can write neat functions to extract every
statistic you want off summary(regg[[N]]). 

-----
----

Isaac
Research Assistant
Quantitative Finance Faculty, UTS
--
View this message in context: 
http://r.789695.n4.nabble.com/Linear-regression-using-matrices-tp4260945p4260988.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@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.

Reply via email to