BIBD - cat's kidney function
To be sure we truly understand what a BIBD looks like, let's build a dataset containing a BIBD from scratch.
Say we want to test the difference between four different wet foods in cats' diets on their kidney function. Cat food, however, is expensive, so we'll only test 3 foods per block to save some money. The blocking factor is the color
of cat, as we aren't interested in that as part of our experiment. The outcome will be measured blood creatinine level, an indicator of kidney function and dysfunction in cats and humans alike.
This exercise is part of the course
Experimental Design in R
Exercise instructions
- The custom function
lambda()
has been loaded for you. Calculatelambda
witht
= 4,k
= 3, andr
= 3 to make sure a BIBD is possible. - Run the code to assemble the dataset. You can see the order in which the food treatments are used in each block.
- Create
cat_model
withaov()
according to the description of the experiment above and examine the results withsummary()
. Does type of wet food make a difference on creatinine levels?
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Calculate lambda
___
# Build the data.frame
creatinine <- c(1.98, 1.97, 2.35, 2.09, 1.87, 1.95, 2.08, 2.01, 1.84, 2.06, 1.97, 2.22)
food <- as.factor(c("A", "C", "D", "A", "B", "C", "B", "C", "D", "A", "B", "D"))
color <- as.factor(rep(c("Black", "White", "Orange", "Spotted"), each = 3))
cat_experiment <- as.data.frame(cbind(creatinine, food, color))
# Create cat_model and examine with summary()
___ <- ___ (___ ~ ___ + color, data = ___)
___