Exercise

Optimal temperature

Tadpoles can swim in both cold and warm water. They are fastest somewhere in-between. Swimming speeds in different temperature water are recorded in the Tadpoles dataset. vmax is the maximum velocity reached by a tadpole swimming in a channel (called a "race"). rtemp is the temperature of the water in the race.

The relationship between vmax and rtemp is not a straight line. Still, there are a variety of ways that the curved nature of the relationship can be captured by a linear model architecture. For instance, you can add a new explanatory term to the model, I(rtemp^2), which lm() will use to make the relationship between vmax and rtemp follow a parabolic (or "U-shaped") form. A parabola has a maximum (or minimum) and so can be an appropriate model for a quantity whose maximum value is of interest.

The biologists studying the tadpoles were not only interested in the optimal temperature for tadpole swimming. They wanted to know whether tadpoles raised in cold water and those raised in warm water would swim fastest in different temperatures. One hypothesis is that tadpoles are habituated to the temperature of water in which they are raised, and swim fastest in temperatures near that.