子代与亲代数据的皮尔逊相关
皮尔逊相关系数似乎是衡量喙深度在亲代与子代之间遗传强度的有用指标。请计算 G. scandens 的亲代与子代喙深度之间的皮尔逊相关系数。对 G. fortis 做同样的计算。然后,使用您在上一个练习中编写的函数,通过配对自助法计算 95% 置信区间。
请记住,数据存储在 bd_parent_scandens、bd_offspring_scandens、bd_parent_fortis 和 bd_offspring_fortis 中。
本练习是课程的一部分
Python 统计思维(第 2 部分)
练习说明
- 使用您在本课程前传中编写的
pearson_r()函数(https://campus.datacamp.com/courses/statistical-thinking-in-python-part-1/quantitative-exploratory-data-analysis?ex=15)计算 G. scandens 和 G. fortis 的皮尔逊相关系数。 - 使用您在上一个练习中编写的
draw_bs_pairs()函数,为 G. scandens 和 G. fortis 获取 1000 组皮尔逊相关系数的配对自助法重复样本。 - 使用自助法重复样本计算这二者的 95% 置信区间。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# 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)