Hi All, I've been searching the help archives but haven't found a workable solution to this problem. I'm running an lme model with the following call: >lme.fnl <- lme(Max ~ S + Tr + Yr + Tr:Yr, random = ~1 |TID) > anova(lme.fnl) numDF denDF F-value p-value (Intercept) 1 168 19255.389 <.0001 S 1 168 5.912 0.0161 Tr 2 116 15.919 <.0001 Yr 1 168 77.837 <.0001 Tr:Yr 2 168 47.584 <.0001 >summary(lme.fnl) Linear mixed-effects model fit by REML Data: NULL AIC BIC logLik 580.6991 613.5399 -281.3496 Random effects: Formula: ~1 | TID (Intercept) Residual StdDev: 0.3697006 0.5316062 Fixed effects: Max ~ S + Tr + Yr + Tr:Yr Value Std.Error DF t-value p-value (Intercept) -13.5681 113.2623 168 -0.119793 0.9048 SM 0.2187 0.0957 168 2.284605 0.0236 TrT97 1375.5897 164.0060 116 8.387434 0.0000 TrT98 2890.9462 455.3497 116 6.348848 0.0000 Yr 0.0099 0.0567 168 0.174005 0.8621 TrT97:Yr -0.6883 0.0821 168 -8.384798 0.0000 TrT98:Yr -1.4463 0.2279 168 -6.347310 0.0000 Correlation: (Intr) SM TrT97 TrT98 Yr TT97:Y SM 0.067 TrT97 -0.691 -0.049 TrT98 -0.248 -0.001 0.171 Yr -1.000 -0.067 0.691 0.248 TrT97:Yr 0.691 0.048 -1.000 -0.171 -0.691 TrT98:Yr 0.248 0.001 -0.171 -1.000 -0.248 0.171 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.19017911 -0.58108001 -0.04983642 0.57323031 2.39811353 Number of Observations: 291 Number of Groups: 119 I'm specifically interested in differences of in the differences between my treatment groups (3) and Year (Yr), and importantly in the interaction. Normally I'm used to running independent contrast analysis to explore these differences, but I'm not sure how to extract this information using lme. Can anyone point me in the right direction? Thanks Ken [[alternative HTML version deleted]]
Andrew Robinson
2007-Apr-30 22:48 UTC
[R] Independent contrasts from lme with interactions
Ken, estimable in the gmodels package will help you. Cheers Andrew On Mon, Apr 30, 2007 at 03:11:57PM -0700, Ken Nussear wrote:> Hi All, > > I've been searching the help archives but haven't found a workable > solution to this problem. > > I'm running an lme model with the following call: > > >lme.fnl <- lme(Max ~ S + Tr + Yr + Tr:Yr, random = ~1 |TID) > > anova(lme.fnl) > numDF denDF F-value p-value > (Intercept) 1 168 19255.389 <.0001 > S 1 168 5.912 0.0161 > Tr 2 116 15.919 <.0001 > Yr 1 168 77.837 <.0001 > Tr:Yr 2 168 47.584 <.0001 > > > >summary(lme.fnl) > Linear mixed-effects model fit by REML > Data: NULL > AIC BIC logLik > 580.6991 613.5399 -281.3496 > > Random effects: > Formula: ~1 | TID > (Intercept) Residual > StdDev: 0.3697006 0.5316062 > > Fixed effects: Max ~ S + Tr + Yr + Tr:Yr > Value Std.Error DF t-value p-value > (Intercept) -13.5681 113.2623 168 -0.119793 0.9048 > SM 0.2187 0.0957 168 2.284605 0.0236 > TrT97 1375.5897 164.0060 116 8.387434 0.0000 > TrT98 2890.9462 455.3497 116 6.348848 0.0000 > Yr 0.0099 0.0567 168 0.174005 0.8621 > TrT97:Yr -0.6883 0.0821 168 -8.384798 0.0000 > TrT98:Yr -1.4463 0.2279 168 -6.347310 0.0000 > Correlation: > (Intr) SM TrT97 TrT98 Yr TT97:Y > SM 0.067 > TrT97 -0.691 -0.049 > TrT98 -0.248 -0.001 0.171 > Yr -1.000 -0.067 0.691 0.248 > TrT97:Yr 0.691 0.048 -1.000 -0.171 -0.691 > TrT98:Yr 0.248 0.001 -0.171 -1.000 -0.248 0.171 > > Standardized Within-Group Residuals: > Min Q1 Med Q3 Max > -2.19017911 -0.58108001 -0.04983642 0.57323031 2.39811353 > > Number of Observations: 291 > Number of Groups: 119 > > > > I'm specifically interested in differences of in the differences > between my treatment groups (3) and Year (Yr), and importantly in the > interaction. Normally I'm used to running independent contrast > analysis to explore these differences, but I'm not sure how to > extract this information using lme. Can anyone point me in the right > direction? > > Thanks > > Ken > > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at 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 > and provide commented, minimal, self-contained, reproducible code.-- Andrew Robinson Department of Mathematics and Statistics Tel: +61-3-8344-9763 University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599 http://www.ms.unimelb.edu.au/~andrewpr http://blogs.mbs.edu/fishing-in-the-bay/
Ken, Take a look at the just released contrast package. Max -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Ken Nussear Sent: Monday, April 30, 2007 6:12 PM To: r-help at stat.math.ethz.ch Subject: [R] Independent contrasts from lme with interactions Hi All, I've been searching the help archives but haven't found a workable solution to this problem. I'm running an lme model with the following call: >lme.fnl <- lme(Max ~ S + Tr + Yr + Tr:Yr, random = ~1 |TID) > anova(lme.fnl) numDF denDF F-value p-value (Intercept) 1 168 19255.389 <.0001 S 1 168 5.912 0.0161 Tr 2 116 15.919 <.0001 Yr 1 168 77.837 <.0001 Tr:Yr 2 168 47.584 <.0001 >summary(lme.fnl) Linear mixed-effects model fit by REML Data: NULL AIC BIC logLik 580.6991 613.5399 -281.3496 Random effects: Formula: ~1 | TID (Intercept) Residual StdDev: 0.3697006 0.5316062 Fixed effects: Max ~ S + Tr + Yr + Tr:Yr Value Std.Error DF t-value p-value (Intercept) -13.5681 113.2623 168 -0.119793 0.9048 SM 0.2187 0.0957 168 2.284605 0.0236 TrT97 1375.5897 164.0060 116 8.387434 0.0000 TrT98 2890.9462 455.3497 116 6.348848 0.0000 Yr 0.0099 0.0567 168 0.174005 0.8621 TrT97:Yr -0.6883 0.0821 168 -8.384798 0.0000 TrT98:Yr -1.4463 0.2279 168 -6.347310 0.0000 Correlation: (Intr) SM TrT97 TrT98 Yr TT97:Y SM 0.067 TrT97 -0.691 -0.049 TrT98 -0.248 -0.001 0.171 Yr -1.000 -0.067 0.691 0.248 TrT97:Yr 0.691 0.048 -1.000 -0.171 -0.691 TrT98:Yr 0.248 0.001 -0.171 -1.000 -0.248 0.171 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -2.19017911 -0.58108001 -0.04983642 0.57323031 2.39811353 Number of Observations: 291 Number of Groups: 119 I'm specifically interested in differences of in the differences between my treatment groups (3) and Year (Yr), and importantly in the interaction. Normally I'm used to running independent contrast analysis to explore these differences, but I'm not sure how to extract this information using lme. Can anyone point me in the right direction? Thanks Ken [[alternative HTML version deleted]] ______________________________________________ R-help at 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 and provide commented, minimal, self-contained, reproducible code. ---------------------------------------------------------------------- LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}