.ND
.pl 100i
.po 3
.na
.SH
Bacteria virus in plant sap

.SH
Usage:
.LP
.nf
.in +0.5i

data(Bacteria)
data(BactRoom)
.in -0.5i
.fi

.SH
Format:
.IP "" 0.5i
Bacteria data frame with 192 observations on 8 variables.
.TS
r l l l.
[,1] 	id 	factor 	bird identifier 
[,2] 	bact 	factor 	bacteria or control 
[,3] 	temp 	factor 	room temperature 
[,4] 	inoc 	factor 	when innoculated
[,5] 	bill 	numeric 	bill length
[,6] 	leg 	numeric 	leg length
[,7] 	code 	factor 	plot code
[,8] 	trt 	trt 	bact*trt combination 
.TE
.IP "" 
BactRoom data frame with 8 observations on 7 variables.
.TS
r l l l.
[,1] 	bact 	factor 	bacteria or control 
[,2] 	temp 	factor 	room temperature 
[,3] 	inoc 	factor 	when innoculated
[,4] 	bill 	numeric 	bill length
[,5] 	leg 	numeric 	leg lenght
[,6] 	code 	factor 	plot code
[,7] 	trt 	trt 	bact*trt combination 
.TE

.in -0.5i

.SH
Details:
.IP "" 0.5i
An experiment performed at the National Wildlife Health Research
Center under the supervision of Michael Samuel (Samuel, Goldberg, Thomas and
Sharp 1995) examined the effect of a certain bacteria
strain (`mycoplasma') on the development of birds.  Unfortunately,
due to the danger of aerial infection, they had to isolate treatment
groups in different rooms.  A very conservative approach would take
each chamber as an experimental unit, regardless of the number of
birds per room.  There were four treatments: `cold, cold+myco,
warm' and `warm+myco'.  In addition, the experiment was run in two
`runs' since there were only `4' rooms.
<P>
Measurements were taken on
almost `200' chicks in these rooms.  It is possible to think of
the experiment as having chicks (or eggs) randomly assigned
to the rooms, and to consider the sample in each room as a random
sample from a population of chicks exposed to that environment
(combination of `temperature' and presence or absence of
`mycoplasma' bacteria).
This experiment on bird development was conducted in two `runs'
separated by several weeks.  Several things could have changed in that
time, including the `mycoplasma' culture, seasonal changes of
chick growth and food or water conditions.  The scientist
`inoculated' eggs in the first `run', but decided to switch
to inoculating young `chicks' in the later `run'.  Earlier
analysis in the text has assumed that `inoculation' could be just
considered as another factor.  Here it is viewed as a blocking factor
with no replication.  That is, strictly speaking it is not possible to
assess the main effect of `inoculation' method since there is no
replication of `runs'.  However, it would be possible to assume
that interactions with `run' were interactions with
`inoculation'.
.in -0.5i

.SH
References:
.IP "" 0.5i
Samuel MD, Goldberg DR, Thomas CB and Sharp P (1995)
``Effects of Mycoplasma anatis and cold stress on
hatching success and growth of mallard ducklings,''
J of Wildlife Diseases 31, 172-178.
.in -0.5i

.SH
Examples:
.LP
.nf
.in +0.5i

# attach library; get data
#library( pda )
data( BactRoom )
BactRoom$trt <- factor( BactRoom$trt )
BactRoom$code <- factor( BactRoom$code )
contrasts( BactRoom$temp ) <- contr.sum
contrasts( BactRoom$bact ) <- contr.sum
contrasts( BactRoom$inoc ) <- contr.sum

BactRoom.badd <- aov( bill ~ temp + bact + inoc, BactRoom )
print( summary( BactRoom.badd ))

BactRoom.full <- aov( bill ~ temp * bact, BactRoom )
print( lsmean( BactRoom.full ))
print( summary( BactRoom.full ))

BactRoom.bill <- aov( bill ~ temp * bact * inoc, BactRoom )
print( lsmean( BactRoom.bill ))

# C:8.1 Bacteria Interaction Plots

tmpar <- par( mfrow=c(1,2) )

BactRoom.trt <- aov( bill ~ trt * inoc, BactRoom )
int.plot( BactRoom.trt, col = 1,
   bar.plot="none",
   xlab="(a) treatment by inoc", ylab="bill length (mm)" )
title( "Figure C:8.1a Wrong Way" )

int.plot( BactRoom.bill, bar.plot="none", col = 1,
   xlab="(b) temp by bact", ylab="", lty = c(1,1,2,2) )
title( "Figure C:8.1b Right Way" )

par( tmpar )
rm( tmpar )

# C:8.2 Bacteria Two Factor Interaction Plots

tmpar <- par( mfrow=c(1,2) )

lsd.plot( BactRoom.full, ylim=range( BactRoom$bill ),
   xlab="(a) interaction plot", ylab="bill length (mm)",
   ypos=40, lty = 1 )
title( "Figure C:8.2a Interaction with LSD" )

tmpar <- par(pty="s")
margin.plot( BactRoom.full, ylim=range( BactRoom$bill ),
   effects=T, xlab="(b) margin plot", ylab="",
   ypos=40, lty = 1 )
title( "Figure C:8.2b Margin Plot with LSD" )
abline(0,1,lty=3)

par( tmpar )
rm( tmpar )

# C:8.3 Bacteria Three Factor Interaction Plots

tmpar <- par( mfrow=c(1,2) )

attach( BactRoom )

Bacteria.ylab <- c("","bill length (mm)")
Bacteria.xlab <- c("(a)","(b)")
names( Bacteria.ylab ) <- names( Bacteria.xlab ) <- levels( inoc )

for ( i in levels( inoc ) )
{
   Bacteria.tmp <- inoc==i
   mplot( as.numeric( temp[Bacteria.tmp] ), bill[Bacteria.tmp],
      group=as.character( bact[Bacteria.tmp] ),
      type="b", xaxt="n",
      xlab = paste( Bacteria.xlab[i], i, "inoc" ),
      ylab = Bacteria.ylab[i],
      ylim = range( bill ) )
   mtext( as.character( unique( temp ) ), 1, 1,
      at = as.numeric( unique( temp ) ) )
   title( "Figure C:8.3 Three-Factor Interactions" )
}
   
detach( )

par( tmpar )
rm( Bacteria.tmp, tmpar )

# C: Bacteria Half-Normal and Effect Plots

tmpar <- par( mfrow = c(1,2), pty = "s" )

# order -- temp:bact:inoc temp:bact bact:inoc temp:inoc inoc bact temp

mqqnorm( BactRoom.bill, group = c("BIT","BT","BI","IT","I","B","T"),
   full = T, xlab = "(a) half-normal quantiles", ylab = "effects",
   main = "Figure C:8.4a Half-Normal Plot" )

effect.plot( BactRoom.bill, xlim = c(\&.5,7.5), xaxt = "n",
   xlab = "(b) terms", ylab = "MS adjusted effects" )
title( "Figure C:8.4b Effects Plot" )
axis( 1, seq(1,7,by=2), c("T","I","IT","BIT") )
axis( 1, seq(2,6,by=2), c("B","BT","BI") )

par( tmpar )
rm( tmpar )

# full data set--code not ready yet!
# model fits for bill and leg
data( Bacteria )
Bacteria$id <- factor( Bacteria$id )
Bacteria$cage <- factor( Bacteria$cage )
Bacteria$day <- ordered( Bacteria$day )
contrasts( Bacteria$temp ) <- contr.sum
contrasts( Bacteria$bact ) <- contr.sum
contrasts( Bacteria$inoc ) <- contr.sum

Bacteria.bill <- aov( bill ~ temp * bact * inoc, Bacteria )
Bacteria.leg <- aov( leg ~ temp * bact * inoc, Bacteria )

Bacteria.rcbd <- aov( bill ~ inoc + bact * temp, Bacteria )

# D:10.2 Bacteria Effect Plot by Bird

tmpar <- par( mfrow = c(1,1) )

effect.plot( Bacteria.bill, xaxt = "n" )
title( "D:10.2 Bacteria Effect Plot by Bird" )
axis( 1, 1:8, c("temp","bact","inoc","T:B","T:I","B:I","T:B:I","resid") )
par( tmpar )
rm( tmpar )

# H:22.2 Bacteria Interaction Plot Adjusted for Runs

tmpar <- par( mfrow = c(1,2) )

effect.plot( Bacteria.rcbd,
   xlab="(a) terms", ylab="MS adjusted effects",
   xlim = c(0.5,5.5), xaxt = "n",
   width = .2 )
title( "H:22.2a Effect Plot Adjusted by Run" )
axis( 1, 1:5, c("run","bact","temp","inter","resid") )

margin.plot( Bacteria.rcbd, factors = c("temp","bact"),
   xlab = "(b) temperature by bacteria",
   ylab = "bill length (mm)" )
title( "H:22.2a Margin Plot Adjusted by Run" )

par( tmpar )
rm( tmpar )

.in -0.5i
.fi
