ccleland at optonline.net
Wed Nov 15 23:58:09 CET 2006
> I need to run a regression analysis with a large number of samples. Each
> sample (identified in the first file column) has its own x and y values. I
> will use the same model in all samples. How can I run the model for each
> sample? In SAS code I would use the "BY SAMPLE" statement.
Here are a couple of ways:
by(warpbreaks, warpbreaks$tension, function(x) lm(breaks ~ wool, data = x))
summary(lmList(breaks ~ wool | tension, warpbreaks))
> [[alternative HTML version deleted]]
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Chuck Cleland, Ph.D.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894
More information about the R-help