Hi Chunlin, You have to write your own myCmatrix.
Cheers Andrew On Wednesday, February 6, 2013, chunlin liu wrote: > Thanks, Andrew. > > > > I studied the function "estimable" in package "gmodels" > > and realized that it could combine the model coefficients together > > if a correct cm matrix is provided. For example, if > > > > mylm <- lm(y ~ x1 + factor(x2) + x3*factor(x4), mydata) > > > > Assume that factors x2 and x4 have 6 and 10 levels respectively. > > If a correct cm matrix myCmatrix is provided, then > > > > estimable(mylm, myCmatrix) > > > > produces all coefficients for the equations/models at all levels. > > As I do not know how lm is computed, > > does anyone know how to obtain myCmatrix from mylm object? > Thanks, > > -chunlin > > On Tue, Feb 5, 2013 at 1:56 AM, Andrew Robinson > <mensuration...@gmail.com<javascript:_e({}, 'cvml', > 'mensuration...@gmail.com');> > > wrote: > >> I think that the excellent estimable function from gmodels should help >> you. >> >> Cheers >> >> Andrew >> >> >> On Tuesday, February 5, 2013, chunlin liu wrote: >> >>> I am wondering how to obtain the model/equation at each level >>> automatically >>> in a regression model with a few factors >>> without looking at summary of the lm model. For example, consider >>> >>> lm.factors <- lm(y ~ x1 + factor(x2)*factor(x3)+x4*factor(x5)) >>> >>> The coefficients of lm.factors in summary(lm.factors) might be >>> complicated. >>> I would like to have the equation at each level from lm.factor. >>> Could you please let me know how to obtain the equation of lm.factors at >>> each level automatically (not looking at summary(lm.factors))? >>> Thanks, >>> >>> -Chunlin >>> >>> [[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. >>> >> >> >> -- >> Andrew Robinson >> Director (A/g), ACERA >> Department of Mathematics and Statistics Tel: +61-3-8344-6410 >> University of Melbourne, VIC 3010 Australia (prefer email) >> http://www.ms.unimelb.edu.au/~andrewpr Fax: +61-3-8344-4599 >> http://www.acera.unimelb.edu.au/ >> >> FAwR: http://www.ms.unimelb.edu.au/~andrewpr/FAwR/ >> SPuR: http://www.ms.unimelb.edu.au/spuRs/ >> > > -- Andrew Robinson Director (A/g), ACERA Senior Lecturer in Applied Statistics Tel: +61-3-8344-6410 Department of Mathematics and Statistics Fax: +61-3-8344 4599 University of Melbourne, VIC 3010 Australia Email: a.robin...@ms.unimelb.edu.au Website: http://www.ms.unimelb.edu.au FAwR: http://www.ms.unimelb.edu.au/~andrewpr/FAwR/ SPuR: http://www.ms.unimelb.edu.au/spuRs/ [[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.