Exercise

# Measuring heritability

Remember that the Pearson correlation coefficient is the ratio of the covariance to the geometric mean of the variances of the two data sets. This is a measure of the correlation between parents and offspring, but might not be the best estimate of heritability. If we stop and think, it makes more sense to define heritability as the ratio of the covariance between parent and offspring to the *variance of the parents alone*. In this exercise, you will estimate the heritability and perform a pairs bootstrap calculation to get the 95% confidence interval.

This exercise highlights a very important point. Statistical inference (and data analysis in general) is not a plug-n-chug enterprise. You need to think carefully about the questions you are seeking to answer with your data and analyze them appropriately. If you are interested in how heritable traits are, the quantity we defined as the heritability is more apt than the off-the-shelf statistic, the Pearson correlation coefficient.

Remember, the data are stored in `bd_parent_scandens`

, `bd_offspring_scandens`

, `bd_parent_fortis`

, and `bd_offspring_fortis`

.

Instructions

**100 XP**

- Write a function
`heritability(parents, offspring)`

that computes heritability defined as the ratio of the covariance of the trait in parents and offspring divided by the variance of the trait in the parents.*Hint*: Remind yourself of the`np.cov()`

function we covered in the prequel to this course. - Use this function to compute the heritability for
*G. scandens*and*G. fortis*. - Acquire 1000 bootstrap replicates of the heritability using pairs bootstrap for
*G. scandens*and*G. fortis*. - Compute the 95% confidence interval for both using your bootstrap replicates.
- Print the results.