Shravan Vasishth
2002-Jan-12 18:02 UTC
[R] Question about mixed-effects models example (Pinheiro and Bates)
Hi all, I'm trying to figure out the example about mixed models in the Pinheiro and Bates book (Mixed-Effects Models in S and S-Plus, 2000, pp. 135-137). One thing I don't understand is: When I run the command fm1Orth.lm <- lm( distance ~ age, Orthodont ) followed by fm2Orth.lm <- update( fm1Orth.lm, formula = distance ~ Sex*age ) and then do summary(fm2Orth.lm) in the output, there's "SexFemale" instead of "Sex" (see below). Why? Call: lm(formula = distance ~ Sex + age + Sex:age, data = Orthodont) Residuals: Min 1Q Median 3Q Max -5.6156 -1.3219 -0.1682 1.3299 5.2469 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 16.3406 1.4162 11.538 < 2e-16 *** SexFemale 1.0321 2.2188 0.465 0.643 age 0.7844 0.1262 6.217 1.07e-08 *** SexFemale:age -0.3048 0.1977 -1.542 0.126 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: 2.257 on 104 degrees of freedom Multiple R-Squared: 0.4227, Adjusted R-squared: 0.4061 F-statistic: 25.39 on 3 and 104 DF, p-value: 2.108e-12 The entire session was as below:> library(nlme)Loading required package: nls> data(Orthodont) > fm1Orth.lm <- lm( distance ~ age, Orthodont ) > summary(fm1Orth.lm)Call: lm(formula = distance ~ age, data = Orthodont) Residuals: Min 1Q Median 3Q Max -6.5037 -1.5778 -0.1833 1.3519 6.3167 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 16.7611 1.2256 13.676 < 2e-16 *** age 0.6602 0.1092 6.047 2.25e-08 *** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: 2.537 on 106 degrees of freedom Multiple R-Squared: 0.2565, Adjusted R-squared: 0.2495 F-statistic: 36.56 on 1 and 106 DF, p-value: 2.248e-08> fm2Orth.lm <- update( fm1Orth.lm, formula = distance ~ Sex*age ) > summary(fm2Orth.lm)Call: lm(formula = distance ~ Sex + age + Sex:age, data = Orthodont) Residuals: Min 1Q Median 3Q Max -5.6156 -1.3219 -0.1682 1.3299 5.2469 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 16.3406 1.4162 11.538 < 2e-16 *** SexFemale 1.0321 2.2188 0.465 0.643 age 0.7844 0.1262 6.217 1.07e-08 *** SexFemale:age -0.3048 0.1977 -1.542 0.126 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: 2.257 on 104 degrees of freedom Multiple R-Squared: 0.4227, Adjusted R-squared: 0.4061 F-statistic: 25.39 on 3 and 104 DF, p-value: 2.108e-12 Thanks in advance, -- Shravan Vasishth http://www.ling.ohio-state.edu/~vasishth -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Thomas Lumley
2002-Jan-12 20:37 UTC
[R] Question about mixed-effects models example (Pinheiro and Bates)
On Sat, 12 Jan 2002, Shravan Vasishth wrote:> Hi all, > > I'm trying to figure out the example about mixed models in the Pinheiro > and Bates book (Mixed-Effects Models in S and S-Plus, 2000, pp. 135-137). > One thing I don't understand is: > > When I run the command > > fm1Orth.lm <- lm( distance ~ age, Orthodont ) > > followed by > > fm2Orth.lm <- update( fm1Orth.lm, formula = distance ~ Sex*age ) > > and then do > > summary(fm2Orth.lm) > > in the output, there's "SexFemale" instead of "Sex" (see below). Why?Because that's how R displays factor constrasts. -thomas Thomas Lumley Asst. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._