Get startedGet started for free

Computing Cohen's d

Now, using the same comparison of Weight difference between Sports, let's calculate the actual effect size for this comparison. As a reminder, these data are summarized in the boxplot below.

Boxplots of body weights of Olympic athletes from two sports

Using the formula seen in the previous video, calculate Cohen's d for the difference in Weight between each Sport. Your data is contained in athletes. pandas and math are loaded into your workspace as pd and ma.

This exercise is part of the course

Performing Experiments in Python

View Course

Exercise instructions

  • Create two series, one for the samples from each Sport.
  • Calculate diff, the difference between the mean of each sample, and pooledstdev, the pooled standard deviation.
  • Calculate Cohen's d and print it.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create series
athl = ____
swim = ____

# Calculate difference between means and pooled standard deviation
diff = swim.mean() - ____
pooledstdev = ma.sqrt((athl.std()**2 + ____)/2 )

# Calculate Cohen's d
cohend = ____ / pooledstdev
print(____)
Edit and Run Code