From: Marc Schwartz (via MN) <mschwartz_at_mn.rr.com>

Date: Fri 26 Aug 2005 - 03:21:21 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 Fri Aug 26 03:28:25 2005

Date: Fri 26 Aug 2005 - 03:21:21 EST

Sorry to reply to my own post, but in reviewing the NAMESPACE file for lme4, it looks like Doug is perhaps planning to add additional model object accessor methods for the lmList class, including resid() and summary(), which are commented out now. coef() is available presently.

So when in place, it would appear that the use of lmList would be advantageous over the use of by().

Marc

On Thu, 2005-08-25 at 11:52 -0500, Marc Schwartz (via MN) wrote:

> That works also (using the example in ?lmList)

*>
**> library(lme4)
**>
**> ?lmList
**>
**> fm1 <- lmList(breaks ~ wool | tension, warpbreaks)
**>
**>
**> However, one still would need to use either sapply() or lapply() as
**> below to get the details that Krishna is looking for.
**>
**> 'fm1' above is a list of models (S4 class 'lmList') not overly different
**> from 'tmp' below, which is a list of models (S3 class 'by').
**>
**> If you review str(fm1) and str(tmp), you would note that they are
**> virtually identical, save the use of slots, etc.
**>
**> HTH,
**>
**> Marc Schwartz
**>
**> On Thu, 2005-08-25 at 12:17 -0400, Randy Johnson wrote:
**> > What about using lmList from the lme4 package?
**> >
**> > Randy
**> >
**> >
**> > On 8/25/05 9:44 AM, "Marc Schwartz" <MSchwartz@mn.rr.com> wrote:
**> >
**> > > 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:
**> > >
**> > > lapply(tmp, summary)
**> > >
**> > > would yield more familiar output as compared to using:
**> > >
**> > > sapply(tmp, summary)
**> > >
**> > > The output from the latter might require a bit more "navigation" through
**> > > the resultant matrix, depending upon how the output is to be ultimately
**> > > used.
**> > >
**> > > 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
**> > >
**> >
**> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**> > Randy Johnson
**> > Laboratory of Genomic Diversity
**> > NCI-Frederick
**> > Bldg 560, Rm 11-85
**> > Frederick, MD 21702
**> > (301)846-1304
**> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**> >
**> > ______________________________________________
**> > 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
*

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 Fri Aug 26 03:28:25 2005

*
This archive was generated by hypermail 2.1.8
: Sun 23 Oct 2005 - 15:51:52 EST
*