| Line 38... |
Line 38... |
| 38 |
Chapter 2 of \emph{Statistical Models in S}
|
38 |
Chapter 2 of \emph{Statistical Models in S}
|
| 39 |
eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.
|
39 |
eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.
|
| 40 |
}
|
40 |
}
|
| 41 |
\examples{
|
41 |
\examples{
|
| 42 |
## reset contrasts to defaults
|
42 |
## reset contrasts to defaults
|
| 43 |
options(contrasts=c("contr.treatment", "contr.poly"))
|
43 |
options(contrasts = c("contr.treatment", "contr.poly"))
|
| 44 |
tens <- with(warpbreaks, C(tension, poly, 1))
|
44 |
tens <- with(warpbreaks, C(tension, poly, 1))
|
| 45 |
\donttest{attributes(tens)}
|
45 |
\donttest{attributes(tens)}
|
| 46 |
## tension SHOULD be an ordered factor, but as it is not we can use
|
46 |
## tension SHOULD be an ordered factor, but as it is not we can use
|
| 47 |
aov(breaks ~ wool + tens + tension, data=warpbreaks)
|
47 |
aov(breaks ~ wool + tens + tension, data = warpbreaks)
|
| 48 |
|
48 |
|
| 49 |
## show the use of ... The default contrast is contr.treatment here
|
49 |
## show the use of ... The default contrast is contr.treatment here
|
| 50 |
summary(lm(breaks ~ wool + C(tension, base=2), data=warpbreaks))
|
50 |
summary(lm(breaks ~ wool + C(tension, base = 2), data = warpbreaks))
|
| 51 |
|
51 |
|
| 52 |
|
52 |
|
| 53 |
# following on from help(esoph)
|
53 |
# following on from help(esoph)
|
| 54 |
model3 <- glm(cbind(ncases, ncontrols) ~ agegp + C(tobgp, , 1) +
|
54 |
model3 <- glm(cbind(ncases, ncontrols) ~ agegp + C(tobgp, , 1) +
|
| 55 |
C(alcgp, , 1), data = esoph, family = binomial())
|
55 |
C(alcgp, , 1), data = esoph, family = binomial())
|