hi: if you make the design matrix correctly, you can fit that using the systemfit function in Arne Henningsen's systemfit package. You need to construct the response by making one long column response of R1 on top of R2 on top of R3. Then you need to make a diagonal X matrix with X1, X2 and X3 being the diagonal "elements" of X. ( use kronecker since I assume that they are matrices ). Then you can fit it in one shot using the systemfit function with method = OLS and singleEqSigma = TRUE. Check the results of course but that should work. I used this technique recently
mark 2011/10/13 Uwe Ligges <lig...@statistik.tu-dortmund.de> > > > 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: >> guoshicheng2...@yeah.net >> > > > No. 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: guoshicheng2...@yeah.net >> [[alternative HTML version deleted]] >> >> ______________________________**________________ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help> >> PLEASE do read the posting guide http://www.R-project.org/** >> posting-guide.html <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<https://stat.ethz.ch/mailman/listinfo/r-help> > PLEASE do read the posting guide http://www.R-project.org/** > posting-guide.html <http://www.R-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ 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.