Description Usage Format Source References Examples
A dairy scientist is interested in the effect on milk yield of feeding
cows hot (lukewarm, actually) instead of cold water. This
may have economic importance if the temperature of water can
alter milk yield by even a pound per week. Animals were put on hot
(or cold) water for three weeks, with measurements taken in the
final week (as 7-day milk yield) of the period. Each
cow was given both hot and cold water over a six week (two
periods), with cows randomized as to whether they received
hot or cold water first in each pair. Cows might be
treated over several pairs of periods during the course of the
study. Milk yield should gradually decrease over time, regardless
of treatment. This decline is confounded with the hot/cold treatment
for any given cow, but can be sorted out by comparing cows given
hot or cold first. There is a covariate
dim (days in milk) that indicates how long the cow has
been producing milk; milk yield tends to rise initially
and then gradually fall, with a total lactation (milk producing)
time of roughly 305 days. In addition the month of entry
into the study is included to help assess seasonal effects if any.
1 |
Drink data frame with 261 observations on 6 variables.
| [,1] | cow | factor | cow identifier |
| [,2] | hc | factor | Heifer or Cow |
| [,3] | trt | factor | treatment group |
| [,4] | per | factor | period (Early/Middle/Late) |
| [,5] | dmi | numeric | dry matter intake (DMI) |
| [,6] | coce | factor | plot code |
Dave Combs
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | # Average measurement per cow
data( Drink )
Drink2 <- Drink[Drink$period < 3,]
Drink4 <- Drink[!is.na(match(Drink$cow,Drink$cow[Drink$period == 4])),]
Drink$cow <- factor( Drink$cow )
Drink$month <- ordered( Drink$month )
Drink$period <- ordered( Drink$period )
Drink.fit <- aov( milk ~ cow + period * water, Drink )
Drink2$cow <- factor( Drink2$cow )
Drink2$month <- ordered( Drink2$month )
Drink2$period <- ordered( Drink2$period )
Drink2.fit <- aov( milk ~ cow + period * water, Drink2 )
Drink4$cow <- factor( Drink4$cow )
Drink4$month <- ordered( Drink4$month )
Drink4$period <- ordered( Drink4$period )
Drink4.fit <- aov( milk ~ cow + period * water, Drink4 )
# I:27.1 Drink cross-over interaction plots
lsd.plot( Drink2.fit, factors = c("period","water"),
xpos = 1.25, xlab = "(a) cows in first two periods",
ylab = "7-day milk yield (lb)",
main = "Figure 27.1",
more = TRUE, split = c(1,1,2,1) )
lsd.plot( Drink4.fit, factors = c("period","water"),
xpos = 1.75, xlab = "(b) cows in all four periods", ylab = "",
main = "Drink",
split = c(2,1,2,1) )
# better approach: mixed model fit using lme()
library(lme4)
Drink2.lme <- lmer(milk ~ period * water + (1|cow),
data = Drink2 )
summary(Drink2.lme)
anova(Drink2.lme)
VarCorr( Drink2.lme)
int.plot( Drink2.lme, factors = c("period","water"),
xpos = 1.25, xlab = "(a) cows in first two periods",
ylab = "7-day milk yield (lb)", bar = "ellipse" )
Drink4.lme <- lmer(milk ~ period * water + (1|cow),
data = Drink4 )
Drink4.lme
anova(Drink4.lme)
VarCorr( Drink4.lme)
int.plot( Drink4.lme, factors = c("period","water"),
xpos = 1.75, xlab = "(b) cows in all four periods",
ylab = "", bar = "ellipse" )
int.plot( Drink4.lme, factors = c("water","period"),
xpos = 1.75, xlab = "(c) cold vs hot",
ylab = "", bar = "ellipse" )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.