[R] re gression with multiple dependent variables?
wdunlap at tibco.com
Wed Oct 28 04:26:00 CET 2009
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Rnewb
> Sent: Tuesday, October 27, 2009 6:44 PM
> To: r-help at 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().
Spotfire, TIBCO Software
> 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.
> View this message in context:
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help