Description Format Details Source Examples
The BIB
data frame has 24 rows and 5 columns.
This data frame contains the following columns:
an ordered factor with levels
1
< 2
< 3
< 8
< 5
< 4
< 6
< 7
a treatment factor with levels 1
to 4
.
a numeric vector representing the response
a numeric vector representing the covariate
a factor with levels
13
and
24
These appear to be constructed data.
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 5.4).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | str(BIB)
if (require("lattice", quietly = TRUE, character = TRUE)) {
xyplot(y ~ x | Block, BIB, groups = Treatment, type = c("g", "p"),
aspect = "xy", auto.key = list(points = TRUE, space = "right",
lines = FALSE))
}
if (require("lme4", quietly = TRUE, character = TRUE)) {
options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly"))
## compare with Output 5.7, p. 188
print(fm1BIB <- lmer(y ~ Treatment * x + (1 | Block), BIB))
print(anova(fm1BIB)) # strong evidence of different slopes
## compare with Output 5.9, p. 193
print(fm2BIB <- lmer(y ~ Treatment + x : Grp + (1 | Block), BIB))
print(anova(fm2BIB))
}
|
'data.frame': 24 obs. of 5 variables:
$ Block : Factor w/ 8 levels "1","2","3","4",..: 1 1 1 2 2 2 3 3 3 4 ...
$ Treatment: Factor w/ 4 levels "1","2","3","4": 1 2 3 1 2 4 1 3 4 2 ...
$ y : num 31 29 31 29 34 33 31 28 34 39 ...
$ x : num 20 18 11 37 37 39 29 12 31 37 ...
$ Grp : Factor w/ 2 levels "13","24": 1 2 1 1 2 2 1 1 2 2 ...
- attr(*, "ginfo")=List of 7
..$ formula :Class 'formula' language y ~ x | Block
.. .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv>
..$ order.groups: logi TRUE
..$ FUN :function (x)
..$ outer : NULL
..$ inner : NULL
..$ labels : list()
..$ units : list()
Linear mixed model fit by REML ['lmerMod']
Formula: y ~ Treatment * x + (1 | Block)
Data: BIB
REML criterion at convergence: 104.8945
Random effects:
Groups Name Std.Dev.
Block (Intercept) 4.272
Residual 1.096
Number of obs: 24, groups: Block, 8
Fixed Effects:
(Intercept) Treatment1 Treatment2 Treatment3 x
22.36784 4.42949 -0.43737 6.27864 0.44255
Treatment1:x Treatment2:x Treatment3:x
-0.22377 0.05338 -0.17918
Analysis of Variance Table
Df Sum Sq Mean Sq F value
Treatment 3 23.447 7.816 6.5110
x 1 136.809 136.809 113.9693
Treatment:x 3 18.427 6.142 5.1168
Linear mixed model fit by REML ['lmerMod']
Formula: y ~ Treatment + x:Grp + (1 | Block)
Data: BIB
REML criterion at convergence: 99.177
Random effects:
Groups Name Std.Dev.
Block (Intercept) 4.304
Residual 1.019
Number of obs: 24, groups: Block, 8
Fixed Effects:
(Intercept) Treatment1 Treatment2 Treatment3 x:Grp13 x:Grp24
20.9452 5.3414 1.1356 8.1810 0.2395 0.4892
Analysis of Variance Table
Df Sum Sq Mean Sq F value
Treatment 3 23.424 7.808 7.5236
x:Grp 2 154.733 77.367 74.5471
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.