Title: | Data sets from "SAS System for Mixed Models" |
---|---|
Description: | Data sets and sample lmer analyses corresponding to the examples in Littell, Milliken, Stroup and Wolfinger (1996), "SAS System for Mixed Models", SAS Institute. |
Authors: | Original by Littell, Milliken, Stroup, and Wolfinger, modifications by Douglas Bates <[email protected]>, Martin Maechler, Ben Bolker and Steven Walker |
Maintainer: | Steven Walker <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0-4 |
Built: | 2024-10-31 21:08:20 UTC |
Source: | https://github.com/cran/SASmixed |
The Animal
data frame has 20 rows and 3 columns giving the
average daily weight gains for animals with different genetic
backgrounds.
This data frame contains the following columns:
a factor denoting the sire. (5 levels)
a factor denoting the dam. (2 levels)
a numeric vector of average daily weight gains
This appears to be a constructed data set.
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 6.4).
str(Animal)
str(Animal)
The AvgDailyGain
data frame has 32 rows and 6 columns.
This data frame contains the following columns:
the animal number
an ordered factor indicating the barn in which the steer was housed.
an ordered factor with levels
0
< 10
< 20
< 30
indicating the amount of medicated feed additive added to
the base ration.
a numeric vector of average daily weight gains over a period of 160 days.
a numeric vector giving the initial weight of the animal
the Treatment
as a numeric variable
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 5.3).
str(AvgDailyGain) if (require("lattice", quietly = TRUE, character = TRUE)) { ## plot of adg versus Treatment by Block xyplot(adg ~ Treatment | Block, AvgDailyGain, type = c("g", "p", "r"), xlab = "Treatment (amount of feed additive)", ylab = "Average daily weight gain (lb.)", aspect = "xy", index.cond = function(x, y) coef(lm(y ~ x))[1]) } if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ## compare with output 5.1, p. 178 print(fm1Adg <- lmer(adg ~ InitWt * Treatment - 1 + (1 | Block), AvgDailyGain)) print(anova(fm1Adg)) # checking significance of terms print(fm2Adg <- lmer(adg ~ InitWt + Treatment + (1 | Block), AvgDailyGain)) print(anova(fm2Adg)) print(lmer(adg ~ InitWt + Treatment - 1 + (1 | Block), AvgDailyGain)) }
str(AvgDailyGain) if (require("lattice", quietly = TRUE, character = TRUE)) { ## plot of adg versus Treatment by Block xyplot(adg ~ Treatment | Block, AvgDailyGain, type = c("g", "p", "r"), xlab = "Treatment (amount of feed additive)", ylab = "Average daily weight gain (lb.)", aspect = "xy", index.cond = function(x, y) coef(lm(y ~ x))[1]) } if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ## compare with output 5.1, p. 178 print(fm1Adg <- lmer(adg ~ InitWt * Treatment - 1 + (1 | Block), AvgDailyGain)) print(anova(fm1Adg)) # checking significance of terms print(fm2Adg <- lmer(adg ~ InitWt + Treatment + (1 | Block), AvgDailyGain)) print(anova(fm2Adg)) print(lmer(adg ~ InitWt + Treatment - 1 + (1 | Block), AvgDailyGain)) }
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).
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)) }
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)) }
The Bond
data frame has 21 rows and 3 columns of data on the
strength required to break metal bonds according to the metal and
the ingot.
This data frame contains the following columns:
a numeric vector of pressures required to break the bond
a factor with levels c
, i
and n
indicating the metal involved (copper, iron or nickel).
an ordered factor indicating the ingot of the composition material.
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 1.2.4).
Mendenhall, M., Wackerly, D. D. and Schaeffer, R. L. (1990), Mathematical Statistics, Wadsworth (Exercise 13.36).
str(Bond) options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) if (require("lme4", quietly = TRUE, character = TRUE)) { ## compare with output 1.1 on p. 6 print(fm1Bond <- lmer(pressure ~ Metal + (1|Ingot), Bond)) print(anova(fm1Bond)) }
str(Bond) options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) if (require("lme4", quietly = TRUE, character = TRUE)) { ## compare with output 1.1 on p. 6 print(fm1Bond <- lmer(pressure ~ Metal + (1|Ingot), Bond)) print(anova(fm1Bond)) }
The Cultivation
data frame has 24 rows and 4 columns of data
from an experiment on the effect on dry weight yield of three
bacterial inoculation treatments applied to two grass cultivars.
This data frame contains the following columns:
a factor with levels 1
to 4
the cultivar factor with levels a
and b
the innoculant factor with levels con
, dea
and
liv
a numeric vector of dry weight yields
Littell, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 2.2(a)).
Littel, R. C., Freund, R. J., and Spector, P. C. (1991), SAS System for Linear Models, Third Ed., SAS Institute.
str(Cultivation) xtabs(~Block+Cult, Cultivation) if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ## compare with Output 2.10, page 58 print(fm1Cult <- lmer(drywt ~ Inoc * Cult + (1|Block) + (1|Cult), Cultivation)) print(anova(fm1Cult)) print(fm2Cult <- lmer(drywt ~ Inoc + Cult + (1|Block) + (1|Cult), Cultivation)) print(anova(fm2Cult)) print(fm3Cult <- lmer(drywt ~ Inoc + (1|Block) + (1|Cult), Cultivation)) print(anova(fm3Cult)) }
str(Cultivation) xtabs(~Block+Cult, Cultivation) if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ## compare with Output 2.10, page 58 print(fm1Cult <- lmer(drywt ~ Inoc * Cult + (1|Block) + (1|Cult), Cultivation)) print(anova(fm1Cult)) print(fm2Cult <- lmer(drywt ~ Inoc + Cult + (1|Block) + (1|Cult), Cultivation)) print(anova(fm2Cult)) print(fm3Cult <- lmer(drywt ~ Inoc + (1|Block) + (1|Cult), Cultivation)) print(anova(fm3Cult)) }
The Demand
data frame has 77 rows and 8 columns of data on
per-capita demand deposits by state and year.
This data frame contains the following columns:
an ordered factor with levels
WA
< FL
< CA
< TX
< IL
< DC
< NY
an ordered factor with levels
1949
< ... < 1959
a numeric vector of per-capita demand deposits
a numeric vector of permanent per-capita personal income
a numeric vector of service charges on demand deposits
a numeric vector of interest rates on time deposits
a numeric vector of interest rates on savings and loan association shares.
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 1.2.4).
Feige, E. L. (1964), The Demand for Liquid Assets: A Temporal Cross-Sectional Analysis., Prentice Hall.
str(Demand) if (require("lme4", quietly = TRUE, character = TRUE)) { ## compare to output 3.13, p. 132 summary(fm1Demand <- lmer(log(d) ~ log(y) + log(rd) + log(rt) + log(rs) + (1|State) + (1|Year), Demand)) }
str(Demand) if (require("lme4", quietly = TRUE, character = TRUE)) { ## compare to output 3.13, p. 132 summary(fm1Demand <- lmer(log(d) ~ log(y) + log(rd) + log(rt) + log(rs) + (1|State) + (1|Year), Demand)) }
The Genetics
data frame has 60 rows and 4 columns.
This data frame contains the following columns:
a factor with levels 1
to 4
a factor with levels 1
to 3
a factor with levels 1
to 5
a numeric vector of crop yields
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 4.5).
str(Genetics) if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) summary(fm1Gen <- lmer(Yield ~ Family + (1|Location/Block), Genetics)) }
str(Genetics) if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) summary(fm1Gen <- lmer(Yield ~ Family + (1|Location/Block), Genetics)) }
The HR
data frame has 120 rows and 5 columns of the heart
rates of patients under one of three possible drug treatments.
This data frame contains the following columns:
an ordered factor indicating the patient.
the drug treatment - a factor with levels a
,
b
and p
where p
represents the placebo.
the patient's base heart rate
the observed heart rate at different times in the experiment
the time of the observation
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 3.5).
str(HR) if (require("lattice", quietly = TRUE, character = TRUE)) { xyplot(HR ~ Time | Patient, HR, type = c("g", "p", "r"), aspect = "xy", index.cond = function(x, y) coef(lm(y ~ x))[1], ylab = "Heart rate (beats/min)") } if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ## linear trend in time print(fm1HR <- lmer(HR ~ Time * Drug + baseHR + (Time|Patient), HR)) print(anova(fm1HR)) ## Not run: fm2HR <- update(fm1HR, weights = varPower(0.5)) # use power-of-mean variance summary(fm2HR) intervals(fm2HR) # variance function does not seem significant anova(fm1HR, fm2HR) # confirm with likelihood ratio ## End(Not run) print(fm3HR <- lmer(HR ~ Time + Drug + baseHR + (Time|Patient), HR)) print(anova(fm3HR)) ## remove Drug term print(fm4HR <- lmer(HR ~ Time + baseHR + (Time|Patient), HR)) print(anova(fm4HR)) }
str(HR) if (require("lattice", quietly = TRUE, character = TRUE)) { xyplot(HR ~ Time | Patient, HR, type = c("g", "p", "r"), aspect = "xy", index.cond = function(x, y) coef(lm(y ~ x))[1], ylab = "Heart rate (beats/min)") } if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ## linear trend in time print(fm1HR <- lmer(HR ~ Time * Drug + baseHR + (Time|Patient), HR)) print(anova(fm1HR)) ## Not run: fm2HR <- update(fm1HR, weights = varPower(0.5)) # use power-of-mean variance summary(fm2HR) intervals(fm2HR) # variance function does not seem significant anova(fm1HR, fm2HR) # confirm with likelihood ratio ## End(Not run) print(fm3HR <- lmer(HR ~ Time + Drug + baseHR + (Time|Patient), HR)) print(anova(fm3HR)) ## remove Drug term print(fm4HR <- lmer(HR ~ Time + baseHR + (Time|Patient), HR)) print(anova(fm4HR)) }
The IncBlk
data frame has 24 rows and 4 columns.
This data frame contains the following columns:
an ordered factor giving the block
a factor with levels 1
to 4
a numeric vector
a numeric vector
These data are probably 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.5).
str(IncBlk)
str(IncBlk)
The Mississippi
data frame has 37 rows and 3 columns.
This data frame contains the following columns:
an ordered factor with levels
3
< 5
< 2
< 1
< 4
< 6
a numeric vector
a factor with levels
1
2
3
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 4.2).
str(Mississippi) if (require("lattice", quietly = TRUE, character = TRUE)) { dotplot(drop(influent:Type) ~ y, groups = Type, Mississippi) } if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ## compare with output 4.1, p. 142 print(fm1Miss <- lmer(y ~ 1 + (1|influent), Mississippi)) ## compare with output 4.2, p. 143 print(fm1MLMiss <- update(fm1Miss, REML=FALSE)) ## BLUP's of random effects on p. 142 ranef(fm1Miss) ## BLUP's of random effects on p. 144 print(ranef(fm1MLMiss)) #intervals(fm1Miss) # interval estimates of variance components ## compare to output 4.8 and 4.9, pp. 150-152 print(fm2Miss <- lmer(y ~ Type+(1|influent), Mississippi, REML=TRUE)) print(anova(fm2Miss)) }
str(Mississippi) if (require("lattice", quietly = TRUE, character = TRUE)) { dotplot(drop(influent:Type) ~ y, groups = Type, Mississippi) } if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ## compare with output 4.1, p. 142 print(fm1Miss <- lmer(y ~ 1 + (1|influent), Mississippi)) ## compare with output 4.2, p. 143 print(fm1MLMiss <- update(fm1Miss, REML=FALSE)) ## BLUP's of random effects on p. 142 ranef(fm1Miss) ## BLUP's of random effects on p. 144 print(ranef(fm1MLMiss)) #intervals(fm1Miss) # interval estimates of variance components ## compare to output 4.8 and 4.9, pp. 150-152 print(fm2Miss <- lmer(y ~ Type+(1|influent), Mississippi, REML=TRUE)) print(anova(fm2Miss)) }
The Multilocation
data frame has 108 rows and 7 columns.
This data frame contains the following columns:
a numeric vector
an ordered factor with levels
B
< D
< E
< I
< G
<
A
< C
< F
< H
a factor
with levels 1
to 3
a factor with levels 1
to 4
a numeric vector
a numeric vector
an ordered
factor with levels
B/1
< B/2
< B/3
< D/1
<
D/2
< D/3
< E/1
< E/2
<
E/3
< I/1
< I/2
< I/3
<
G/1
< G/2
< G/3
< A/1
<
A/2
< A/3
< C/1
< C/2
<
C/3
< F/1
< F/2
< F/3
<
H/1
< H/2
< H/3
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 2.8.1).
str(Multilocation) if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ### Create a Block %in% Location factor Multilocation$Grp <- with(Multilocation, Block:Location) print(fm1Mult <- lmer(Adj ~ Location * Trt + (1|Grp), Multilocation)) print(anova(fm1Mult)) print(fm2Mult <- lmer(Adj ~ Location + Trt + (1|Grp), Multilocation), corr=FALSE) print(fm3Mult <- lmer(Adj ~ Location + (1|Grp), Multilocation), corr=FALSE) print(fm4Mult <- lmer(Adj ~ Trt + (1|Grp), Multilocation)) print(fm5Mult <- lmer(Adj ~ 1 + (1|Grp), Multilocation)) print(anova(fm2Mult)) print(anova(fm1Mult, fm2Mult, fm3Mult, fm4Mult, fm5Mult)) ### Treating the location as a random effect print(fm1MultR <- lmer(Adj ~ Trt + (1|Location/Trt) + (1|Grp), Multilocation)) print(anova(fm1MultR)) fm2MultR <- lmer(Adj ~ Trt + (Trt - 1|Location) + (1|Block), Multilocation) ## Warning (not error ?!): Convergence failure in 10000 iter %% __FIXME__ print(fm2MultR)# does not mention previous conv.failure %% FIXME ?? print(anova(fm1MultR, fm2MultR)) ## Not run: confint(fm1MultR) ## End(Not run) }
str(Multilocation) if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ### Create a Block %in% Location factor Multilocation$Grp <- with(Multilocation, Block:Location) print(fm1Mult <- lmer(Adj ~ Location * Trt + (1|Grp), Multilocation)) print(anova(fm1Mult)) print(fm2Mult <- lmer(Adj ~ Location + Trt + (1|Grp), Multilocation), corr=FALSE) print(fm3Mult <- lmer(Adj ~ Location + (1|Grp), Multilocation), corr=FALSE) print(fm4Mult <- lmer(Adj ~ Trt + (1|Grp), Multilocation)) print(fm5Mult <- lmer(Adj ~ 1 + (1|Grp), Multilocation)) print(anova(fm2Mult)) print(anova(fm1Mult, fm2Mult, fm3Mult, fm4Mult, fm5Mult)) ### Treating the location as a random effect print(fm1MultR <- lmer(Adj ~ Trt + (1|Location/Trt) + (1|Grp), Multilocation)) print(anova(fm1MultR)) fm2MultR <- lmer(Adj ~ Trt + (Trt - 1|Location) + (1|Block), Multilocation) ## Warning (not error ?!): Convergence failure in 10000 iter %% __FIXME__ print(fm2MultR)# does not mention previous conv.failure %% FIXME ?? print(anova(fm1MultR, fm2MultR)) ## Not run: confint(fm1MultR) ## End(Not run) }
The PBIB
data frame has 60 rows and 3 columns.
This data frame contains the following columns:
a numeric vector
a factor with levels 1
to 15
an ordered factor with levels 1
to 15
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 1.5.1).
str(PBIB) if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ## compare with output 1.7 pp. 24-25 print(fm1PBIB <- lmer(response ~ Treatment + (1|Block), PBIB)) print(anova(fm1PBIB)) }
str(PBIB) if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ## compare with output 1.7 pp. 24-25 print(fm1PBIB <- lmer(response ~ Treatment + (1|Block), PBIB)) print(anova(fm1PBIB)) }
The Semi2
data frame has 72 rows and 5 columns.
This data frame contains the following columns:
a factor with levels 1
and 2
a factor with levels 1
to 8
a factor with levels 1
to 3
a factor with levels 1
to 3
a numeric vector
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 4.4).
str(Semi2) xtabs(~Lot + Wafer, Semi2) if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ## compare with output 4.13, p. 156 print(fm1Semi2 <- lmer(Thickness ~ 1 + (1|Lot/Wafer), Semi2)) ## compare with output 4.15, p. 159 print(fm2Semi2 <- lmer(Thickness ~ Source + (1|Lot/Wafer), Semi2)) print(anova(fm2Semi2)) ## compare with output 4.17, p. 163 print(fm3Semi2 <- lmer(Thickness ~ Source + (1|Lot/Wafer) + (1|Lot:Source), Semi2)) ## This is not the same as the SAS model. }
str(Semi2) xtabs(~Lot + Wafer, Semi2) if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ## compare with output 4.13, p. 156 print(fm1Semi2 <- lmer(Thickness ~ 1 + (1|Lot/Wafer), Semi2)) ## compare with output 4.15, p. 159 print(fm2Semi2 <- lmer(Thickness ~ Source + (1|Lot/Wafer), Semi2)) print(anova(fm2Semi2)) ## compare with output 4.17, p. 163 print(fm3Semi2 <- lmer(Thickness ~ Source + (1|Lot/Wafer) + (1|Lot:Source), Semi2)) ## This is not the same as the SAS model. }
The Semiconductor
data frame has 48 rows and 5 columns.
This data frame contains the following columns:
a numeric vector
a factor with levels 1
to 4
representing etch time.
a factor with levels 1
to 3
a factor with levels 1
to 4
an ordered factor with levels
1/1
< 1/2
< 1/3
< 2/1
< 2/2
< 2/3
< 3/1
< 3/2
< 3/3
< 4/1
< 4/2
< 4/3
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 2.2(b)).
str(Semiconductor) if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) print(fm1Semi <- lmer(resistance ~ ET * position + (1|Grp), Semiconductor)) print(anova(fm1Semi)) print((fm2Semi <- lmer(resistance ~ ET + position + (1|Grp), Semiconductor))) print(anova(fm2Semi)) }
str(Semiconductor) if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) print(fm1Semi <- lmer(resistance ~ ET * position + (1|Grp), Semiconductor)) print(anova(fm1Semi)) print((fm2Semi <- lmer(resistance ~ ET + position + (1|Grp), Semiconductor))) print(anova(fm2Semi)) }
The SIMS
data frame has 3691 rows and 3 columns.
This data frame contains the following columns:
a numeric vector giving the student's pre-test total score
a numeric vector giving gains from pre-test to the final test
an ordered factor giving the student's class
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (section 7.2.2)
Kreft, I. G. G., De Leeuw, J. and Var Der Leeden, R. (1994), “Review of five multilevel analysis programs: BMDP-5V, GENMOD, HLM, ML3, and VARCL”, American Statistician, 48, 324–335.
str(SIMS) if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ## compare to output 7.4, p. 262 print(fm1SIMS <- lmer(Gain ~ Pretot + (Pretot | Class), data = SIMS)) print(anova(fm1SIMS)) }
str(SIMS) if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ## compare to output 7.4, p. 262 print(fm1SIMS <- lmer(Gain ~ Pretot + (Pretot | Class), data = SIMS)) print(anova(fm1SIMS)) }
The TeachingI
data frame has 96 rows and 7 columns.
This data frame contains the following columns:
a factor with levels 1
to 3
a factor with levels 1
to 4
a factor with levels f
and m
a factor with levels 1
to 4
a numeric vector
a numeric vector
an ordered factor with levels
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 5.6).
str(TeachingI)
str(TeachingI)
The TeachingII
data frame has 96 rows and 6 columns.
This data frame contains the following columns:
a factor with levels 1
to 3
a factor with levels 1
to 4
a factor with levels f
and m
a numeric vector
a numeric vector
an ordered factor with levels
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 5.7).
str(TeachingII)
str(TeachingII)
The WaferTypes
data frame has 144 rows and 8 columns.
This data frame contains the following columns:
a factor with levels 1
to 4
an ordered factor with levels
900
< 1000
< 1100
a factor with levels A
and B
a numeric vector
a numeric vector
a numeric vector
a numeric vector
an ordered factor giving a unique code to each group, temperature, type and wafer combination.
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 5.8).
str(WaferTypes)
str(WaferTypes)
The Weights
data frame has 399 rows and 5 columns.
This data frame contains the following columns:
a numeric vector
a factor with levels 1
to 21
a factor with levels
CONT
(continuous repetitions and weights),
RI
(repetitions increasing) and
WI
(weights increasing)
an ordered factor indicating the subject on which the measurement is made
a numeric vector indicating the time of the measurement
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 3.2(a)).
str(Weights) if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ## compare with output 3.1, p. 91 print(fm1Weight <- lmer(strength ~ Program * Time + (1|Subj), Weights)) print(anova(fm1Weight)) print(fm2Weight <- lmer(strength ~ Program * Time + (Time|Subj), Weights)) print(anova(fm1Weight, fm2Weight)) ## Not run: intervals(fm2Weight) fm3Weight <- update(fm2Weight, correlation = corAR1()) anova(fm2Weight, fm3Weight) fm4Weight <- update(fm3Weight, strength ~ Program * (Time + I(Time^2)), random = ~Time|Subj) summary(fm4Weight) anova(fm4Weight) intervals(fm4Weight) ## End(Not run) }
str(Weights) if (require("lme4", quietly = TRUE, character = TRUE)) { options(contrasts = c(unordered = "contr.SAS", ordered = "contr.poly")) ## compare with output 3.1, p. 91 print(fm1Weight <- lmer(strength ~ Program * Time + (1|Subj), Weights)) print(anova(fm1Weight)) print(fm2Weight <- lmer(strength ~ Program * Time + (Time|Subj), Weights)) print(anova(fm1Weight, fm2Weight)) ## Not run: intervals(fm2Weight) fm3Weight <- update(fm2Weight, correlation = corAR1()) anova(fm2Weight, fm3Weight) fm4Weight <- update(fm3Weight, strength ~ Program * (Time + I(Time^2)), random = ~Time|Subj) summary(fm4Weight) anova(fm4Weight) intervals(fm4Weight) ## End(Not run) }
The WWheat
data frame has 60 rows and 3 columns.
This data frame contains the following columns:
an ordered factor with 10 levels
a numeric vector of yields
a numeric vector of soil moisture contents
Littel, R. C., Milliken, G. A., Stroup, W. W., and Wolfinger, R. D. (1996), SAS System for Mixed Models, SAS Institute (Data Set 7.2).
str(WWheat)
str(WWheat)