angelo.arcadi at virgilio.it
2015-Nov-22 22:44 UTC
[R] How to plot results from lme in presence of a significant interaction
Dear list members, I wonder which is the best way to plot in r the results from the lme function, in presence of a significant interaction. My model has two interacting fixed effects and a random effect. The analysis is from an experiment where 19 participants had to adjust the Centroid parameter of some sounds stimuli, and I want to assess whether there is a relationship between their choices and their height and weight. There were 12 stimuli repeated twice for a total of 24 trials. Here is the output of my analysis: > library(nlme) > lme_Centroid <- lme(Centroid ~ Weight*Height, data = scrd, random = ~1 | Subject) > > summary(lme_Centroid) Linear mixed-effects model fit by REML Data: scrd AIC BIC logLik 25809.38 25840.69 -12898.69 Random effects: Formula: ~1 | Subject (Intercept) Residual StdDev: 398.9658 3027.67 Fixed effects: Centroid ~ Weight * Height Value Std.Error DF t-value p-value (Intercept) -20232.203 9101.096 1349 -2.223051 0.0264 Weight 478.854 152.184 15 3.146536 0.0067 Height 140.440 52.194 15 2.690751 0.0168 Weight:Height -2.725 0.838 15 -3.253770 0.0053 Correlation: (Intr) Weight Height Weight -0.927 Height -0.994 0.886 Weight:Height 0.951 -0.996 -0.919 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.5059828 -0.8664208 -0.2111113 0.7098706 2.3620633 Number of Observations: 1368 Number of Groups: 19 I do not know how to represent in R these results. I tried xyplot(Centroid ~ Weight * Height, type = c("p","r"), data = scrd) but I guess it is wrong. Thank you in advance Best regards Angelo [[alternative HTML version deleted]]
Bert Gunter
2015-Nov-22 23:45 UTC
[R] How to plot results from lme in presence of a significant interaction
I would have thought the first place to look would be ?interaction.plot Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Sun, Nov 22, 2015 at 2:44 PM, angelo.arcadi at virgilio.it <angelo.arcadi at virgilio.it> wrote:> Dear list members, > I wonder which is the best way to plot in r the > results from the lme function, in presence of a significant interaction. > My model has two interacting fixed effects and a random effect. The > analysis is from an experiment where 19 participants had to adjust the > Centroid parameter of some sounds stimuli, and I want to assess whether > there is a relationship between their choices and their height and > weight. There were 12 stimuli repeated twice for a total of 24 trials. > Here is the output of my analysis: > > > library(nlme) > > lme_Centroid <- lme(Centroid ~ Weight*Height, data = scrd, random = ~1 | Subject) > > > > summary(lme_Centroid) > Linear mixed-effects model fit by REML > Data: scrd > AIC BIC logLik > 25809.38 25840.69 -12898.69 > > Random effects: > Formula: ~1 | Subject > (Intercept) Residual > StdDev: 398.9658 3027.67 > > Fixed effects: Centroid ~ Weight * Height > Value Std.Error DF t-value p-value > (Intercept) -20232.203 9101.096 1349 -2.223051 0.0264 > Weight 478.854 152.184 15 3.146536 0.0067 > Height 140.440 52.194 15 2.690751 0.0168 > Weight:Height -2.725 0.838 15 -3.253770 0.0053 > Correlation: > (Intr) Weight Height > Weight -0.927 > Height -0.994 0.886 > Weight:Height 0.951 -0.996 -0.919 > > Standardized Within-Group Residuals: > Min Q1 Med Q3 Max > -1.5059828 -0.8664208 -0.2111113 0.7098706 2.3620633 > > Number of Observations: 1368 > Number of Groups: 19 > > > > I > do not know how to represent in R these results. I tried > xyplot(Centroid ~ Weight * Height, type = c("p","r"), data = scrd) but I > guess it is wrong. > > Thank you in advance > > Best regards > > Angelo > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.
Fox, John
2015-Nov-23 12:50 UTC
[R] How to plot results from lme in presence of a significant interaction
Dear Angelo, You might try the Effect() function in the effects package: plot(Effect(c("Weight", "Height"), lme_Centroid)) . I hope this helps, John ----------------------------- John Fox, Professor McMaster University Hamilton, Ontario Canada L8S 4M4 Web: socserv.mcmaster.ca/jfox> -----Original Message----- > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of > angelo.arcadi at virgilio.it > Sent: November 22, 2015 5:44 PM > To: r-help at r-project.org > Subject: [R] How to plot results from lme in presence of a significant interaction > > Dear list members, > I wonder which is the best way to plot in r the results from the lme function, in > presence of a significant interaction. > My model has two interacting fixed effects and a random effect. The analysis is > from an experiment where 19 participants had to adjust the Centroid > parameter of some sounds stimuli, and I want to assess whether there is a > relationship between their choices and their height and weight. There were 12 > stimuli repeated twice for a total of 24 trials. > Here is the output of my analysis: > > > library(nlme) > > lme_Centroid <- lme(Centroid ~ Weight*Height, data = scrd, random = ~1 | > Subject) > > > > summary(lme_Centroid) > Linear mixed-effects model fit by REML > Data: scrd > AIC BIC logLik > 25809.38 25840.69 -12898.69 > > Random effects: > Formula: ~1 | Subject > (Intercept) Residual > StdDev: 398.9658 3027.67 > > Fixed effects: Centroid ~ Weight * Height > Value Std.Error DF t-value p-value > (Intercept) -20232.203 9101.096 1349 -2.223051 0.0264 > Weight 478.854 152.184 15 3.146536 0.0067 > Height 140.440 52.194 15 2.690751 0.0168 > Weight:Height -2.725 0.838 15 -3.253770 0.0053 > Correlation: > (Intr) Weight Height > Weight -0.927 > Height -0.994 0.886 > Weight:Height 0.951 -0.996 -0.919 > > Standardized Within-Group Residuals: > Min Q1 Med Q3 Max > -1.5059828 -0.8664208 -0.2111113 0.7098706 2.3620633 > > Number of Observations: 1368 > Number of Groups: 19 > > > > I > do not know how to represent in R these results. I tried xyplot(Centroid ~ > Weight * Height, type = c("p","r"), data = scrd) but I guess it is wrong. > > Thank you in advance > > Best regards > > Angelo > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.