> -----Original Message----- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Rnewb > Sent: Tuesday, October 27, 2009 6:44 PM > To: r-help@r-project.org > Subject: [R] re gression with multiple dependent variables? > > > i have a series of regressions i need to run where everything > is the same > except for the dependent variable, e.g.: > > lm(y1 ~ x1+x2+x3+x4+x5, data=data) > lm(y2 ~ x1+x2+x3+x4+x5, data=data) > lm(y3 ~ x1+x2+x3+x4+x5, data=data)
You can do with(data, lm.fit(x=cbind(Intercept=1,x1,x2,x3), y=cbind(y1,y2,y3))) lm.fit is the numerical code behind lm(). Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > > is it possible to run all these regs with a single command? > given that the > bulk of the work for linear regressions is inverting a matrix > that depends > only on the independent variables, it seems like a waste to > do it over and > over for each new dependent variable. > > thanks, > Rnewb > -- > View this message in context: > http://www.nabble.com/regression-with-multiple-dependent-varia bles--tp26088025p26088025.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. > ______________________________________________ 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.