
• 16. t: Example Data
We are taking another break from our Clarkia data, as I couldn’t find a great example for a one-tailed t-test there.

Set up and scientific hypothesis
As the climate warms, the habitats suitable for many species are moving. Species can respond in several ways: they can adapt to the new conditions, tolerate them, or move to track their preferred environment. If they can’t do any of these, they may go extinct locally. A study (Chen et al. (2011)) combined data for over thirty taxonomic groups to address a key question: ’Do species, on average, move to higher elevations to keep up with a changing climate?’”
Hypotheses
Null Hypothesis (\(H_0\)): The true mean elevational shift (\(\mu\)) is zero. Any observed shift from our sample is due to random chance (\(H_0: \mu=0\)).
Alternative Hypothesis (\(H_A\)): The true mean elevational shift (\(\mu\)) is not zero. Species are, on average, shifting their elevation (\(H_A: \mu \neq 0\)).
- Note that although the scientific hypothesis was one-tailed, it is common practice to test the two-tailed alternative hypothesis, and a one-tailed test raises suspicions.
The data
The data , are available here and represent the rate of upward or downward movement of a species’ range, measured in meters per decade. Each data point is the mean elevation shift for a particular taxonomic group in a specific geographic region (e.g., plants in the Green Mountains in Vermont - Figure 1). A positive value indicates a species group has moved uphill to a higher elevation, while a negative value means it has moved downhill to a lower elevation.
Code
library(tidyr)
library(dplyr)
<- "https://whitlockschluter3e.zoology.ubc.ca/Data/chapter11/chap11q01RangeShiftsWithClimateChange.csv"
range_shift_file <- read_csv(range_shift_file) |>
range_shift mutate(uphill = elevationalRangeShift > 0)|>
separate(taxonAndLocation, into = c("taxon", "location"), sep = "_")