Multiple Two-Sample T-Tests
Analysis of Variance
Tukey’s Range Test
Hypothesis Testing Assumptions
from scipy.stats import ttest_ind #separate out claw lengths for two species grizzly_bear = data.claw_length[data.species=='grizzly'] black_bear = data.claw_length[data.species=='black'] #run the t-test here: tstat, pval = ttest_ind(grizzly_bear, black_bear)
We can test an association between a quantitative variable and a binary categorical variable by using a two-sample t-test. The null hypothesis for a two-sample t-test is that the difference in group means is equal to zero. A two-sample t-test can be implemented in Python using the
ttest_ind() function from
scipy.stats. The example code shows a two-sample t-test for testing an association between claw length and species of bear (grizzly or black).