From: Marc Schwartz <MSchwartz_at_mn.rr.com>

Date: Thu 25 Aug 2005 - 23:44:13 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Aug 25 23:49:05 2005

Date: Thu 25 Aug 2005 - 23:44:13 EST

Also, looking at the last example in ?by would be helpful:

attach(warpbreaks)

tmp <- by(warpbreaks, tension, function(x) lm(breaks ~ wool, data = x))

# To get coefficients:

sapply(tmp, coef)

# To get residuals:

sapply(tmp, resid)

# To get the model matrix:

sapply(tmp, model.matrix)

To get the summary() output, I suspect that using:

would yield more familiar output as compared to using:

**HTH,
**
Marc Schwartz

On Thu, 2005-08-25 at 14:57 +0200, TEMPL Matthias wrote:

> Look more carefully at

*> ?lm
**> at the See Also section ...
**>
**> X <- rnorm(30)
**> Y <- rnorm(30)
**> lm(Y~X)
**> summary(lm(Y~X))
**>
**> Best,
**> Matthias
**>
**>
**> > Hi all
**> >
**> > I used a function
**> > > qtrregr <- by(AB, AB$qtr, function(AB) lm(AB$X~AB$Y))
**> >
**> > objective is to run a regression on quartery subsets in the
**> > data set AB, having variables X and Y, grouped by variable qtr.
**> >
**> > Now i retrieved the output using qtrregr, however it only
**> > showed the coefficients (intercept and B) with out
**> > significant levels and residuals for each qtr. Can some on
**> > help me on how can retrieve the detailed regression output.
**> >
**> > rgds
**> >
**> > snvk
**> >
*

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Aug 25 23:49:05 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:39:56 EST
*