Description Usage Format Source References Examples
This experiment (Wattiaux, Combs and Shaver 1994) involved 60 cows
initially, although some were lost
during the study. The cows were randomly assigned to one of 6 diets
and followed for a number of weeks. Diets were begun after the third
week, allowing the animals some initial time to adjust to their new
environment. Interest focuses on the effect of diet on the average
dry matter intake (dmi
), the amount of food eaten by each cow.
The data you have are a baseline value (covar
= dmi
for week 3), average dmi
during subsequent weeks, the
number of subsequent weeks
. In addition there are cow and
block identifiers.
The experiment was a randomized block design. That is, cows were blocked
by time, the first 6 cows were randomly assigned among the 6 diets,
and so on. “Proper” analysis should take account of this, along with
the initial capacity of each animal (its covariate
of dry matter
intake at 3 weeks) and possibly weighting by the number of weeks
each cow was on trial.
1 |
Diet data frame with 12 observations on 7 variables.
[,1] | trt | factor | treatment identifier |
[,2] | bwt | numeric | body weight |
[,3] | bwg | numeric | body weight gain |
[,4] | fi | numeric | diet intake |
[,5] | fe | numeric | diet(?) |
[,6] | cla | numeric | CLA amount |
[,6] | la | numeric | LA amount |
Michel Wattiaux, International Agriculture Program, CALS, UW-Madison
Wattiaux MA, Combs DK and Shaver RD (1994) “Lactational responses to ruminally undegradable protein by dairy cows fed diets based on alfalfa silage”, J Dairy Science 77, 1604-1617.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | data( Diet )
Diet$trt <- factor(Diet$trt)
Diet$block <- factor(Diet$block)
#
# ordinary anova
Diet.fit <- aov(dmi ~ trt, Diet)
# ancova with covar = first 3 weeks dmi
Diet.cov <- lm(dmi ~ covar + trt, Diet, na.action=na.omit)
# ancova with blocking and weighting by number of weeks on trial
Diet.blk <- lm(dmi ~ covar + block + trt, Diet,
weights=Diet$weeks, na.action=na.omit)
# Figure F17.2: Diet Adjusted for Initial Capacity
## regression lines in following plot are not parallel
Diet = Diet[!is.na(Diet$covar), ]
Diet$pred = predict(Diet.cov)
trellis.par.set(theme=col.whitebg())
print(xyplot(dmi ~ covar, Diet, groups = trt, type = "p",
pch = levels(Diet$trt), cex = 1.5,
col = 1 + as.numeric(levels(Diet$trt)),
panel = function(x,y,...) {
panel.superpose(x,y,...)
pred = predict(Diet.cov)
for(i in levels(Diet$trt)) {
ii = Diet$trt == i
i = as.numeric(i)
panel.lines(Diet$covar[ii], Diet$pred[ii],
lty = i, col = i + 1)
}
## SD bar
lsd.bar(Diet.cov, xpos = 24, ypos=20, cap = "SD")
},
xlab = "covariate = first 3 weeks",
ylab = "dry matter intake (dmi)",
main = "Figure F:17.2 Diet Adjusted for Initial Capacity"))
data.frame(se.bar(26, 20, std.dev(Diet.cov), cap = "SD"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.