Drink {pda} | R Documentation |
A dairy scientist is interested in the effect on milk yield of feeding
cow
s 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
period
s), with cow
s randomized as to whether they received
hot or cold water
first in each pair. Cow
s might be
treated over several pairs of period
s 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 cow
s 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.
data(Drink)
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.
# 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" )