guoshicheng2005
2011-Oct-13 13:50 UTC
[R] Can I use lm() to fit more than one response and more than one variables in single expression
Dear All, Can I use lm() to fit more than one response in single expression. e.g data is a matrix of these variables R1 R2 R3 X1 X2 X3 1 2 1 1 2 3 Now i wnat to fit R1~X1 R2~X2 R3~X3 in turn, and I don't want to do it use loops of couse it it easy to make it using loops,but the proceed is very slow since the data is very big Can't anybody give me some tips or help, my eamil: guoshicheng2005@yeah.net 2011-10-13 Best wishes Yours Alxe -- Ministry of Education Key Laboratory of Contemporary Anthropology School of Life Sciences, Fudan University 220 Handan Road Shanghai, China 200433 Phone:15216760764 E-mail: guoshicheng2005@yeah.net [[alternative HTML version deleted]]
Uwe Ligges
2011-Oct-13 14:29 UTC
[R] Can I use lm() to fit more than one response and more than one variables in single expression
On 13.10.2011 15:50, guoshicheng2005 wrote:> Dear All, > Can I use lm() to fit more than one response in > single expression. e.g data is a matrix of these > variables > R1 R2 R3 X1 X2 X3 > 1 2 1 1 2 3 > > Now i wnat to fit > R1~X1 > R2~X2 > R3~X3 > > in turn, and I don't want to do it use loops > > of couse it it easy to make it using loops,but the proceed is very slow since the data is very big > > Can't anybody give me some tips or help, my eamil: guoshicheng2005 at yeah.netNo. You will have to iterate in some way. How big can the data be that this is slow? Anyway, since there may be overhead by calling it via the formula interface,. you can directly fit using an explicitly given Design matrix in lm.fit(). Best, Uwe Ligges> > > 2011-10-13 > > > > Best wishes > Yours Alxe > > -- > Ministry of Education Key Laboratory of Contemporary Anthropology > School of Life Sciences, Fudan University > 220 Handan Road > Shanghai, China 200433 > Phone:15216760764 > E-mail: guoshicheng2005 at yeah.net > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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.