Get startedGet started for free

Pearson correlation of offspring and parental data

The Pearson correlation coefficient seems like a useful measure of how strongly the beak depth of parents are inherited by their offspring. Compute the Pearson correlation coefficient between parental and offspring beak depths for G. scandens. Do the same for G. fortis. Then, use the function you wrote in the last exercise to compute a 95% confidence interval using pairs bootstrap.

Remember, the data are stored in bd_parent_scandens, bd_offspring_scandens, bd_parent_fortis, and bd_offspring_fortis.

This exercise is part of the course

Statistical Thinking in Python (Part 2)

View Course

Exercise instructions

  • Use the pearson_r() function you wrote in the prequel to this course to compute the Pearson correlation coefficient for G. scandens and G. fortis.
  • Acquire 1000 pairs bootstrap replicates of the Pearson correlation coefficient using the draw_bs_pairs() function you wrote in the previous exercise for G. scandens and G. fortis.
  • Compute the 95% confidence interval for both using your bootstrap replicates.

Hands-on interactive exercise

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

# Compute the Pearson correlation coefficients
r_scandens = ____
r_fortis = ____

# Acquire 1000 bootstrap replicates of Pearson r
bs_replicates_scandens = ____

bs_replicates_fortis = ____


# Compute 95% confidence intervals
conf_int_scandens = ____
conf_int_fortis = ____

# Print results
print('G. scandens:', r_scandens, conf_int_scandens)
print('G. fortis:', r_fortis, conf_int_fortis)
Edit and Run Code