有没有办法在Python中找到r置信区间?
在R我可以做类似的事情:
cor.test(m, h)
Pearson's product-moment correlation
data: m and h
t = 0.8974, df = 4, p-value = 0.4202
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.6022868 0.9164582
sample estimates:
cor
0.4093729
Run Code Online (Sandbox Code Playgroud)
在Python中我可以使用以下公式计算r(cor):
r,p = scipy.stats.pearsonr(df.age, df.pets)
Run Code Online (Sandbox Code Playgroud)
但这不会返回r置信区间.