Skip to content
Prev 296068 / 398502 Next

Customized R Regression Output?

Are the x variables all the same?  if so, you can give lm a matrix as
the y variable and it will compute all the different regressions for
each column in the y matrix.  The summary function will then return a
list with the summary information for each of the regressions.

If the x variables are not identical between regressions then you
could stack all your data sets in a data frame and use the lmList
function from the nlme package to do all the regressions in one step
and get a list of returns.

In either case you can then use the sapply function to extract the
information you want from each summary and it will combine them into a
matrix for you (or use the plyr package for a little more control).
On Sun, May 27, 2012 at 6:20 AM, Chris87 <c.satzky at gmail.com> wrote: