简体   繁体   English

Pearsonr 和 p 值

[英]Pearsonr and p-value

I am analyzing some data in pandas and plotting correlations between two variables using sns.jointplot() function.我正在分析熊猫中的一些数据并使用sns.jointplot()函数绘制两个变量之间的相关性。 The results for correlation between these two function looks like this:这两个函数之间的相关性结果如下所示: 在此处输入图片说明

The value for pearsonr is 0.41 and p is 5e-18. pearsonr 的值为 0.41,p 为 5e-18。 What can i infer from these two values.我可以从这两个值中推断出什么。 Is there a good relationship between these two variables are not.这两个变量之间有没有很好的关系。

Also if I want to just display pearsonr on the plot, how should I change my code.另外,如果我只想在绘图上显示 pearsonr,我应该如何更改我的代码。 Below is the code that I a using currently.下面是我目前使用的代码。

ax=sns.jointplot(df['Comfort'], df['Assurance'],data=df, kind="kde", color='r');

The value for pearsonr is 0.41 and p is 5e-18. pearsonr 的值为 0.41,p 为 5e-18。 What can i infer from these two values.我可以从这两个值中推断出什么。 Is there a good relationship between these two variables are not.这两个变量之间有没有很好的关系。

Roughly speaking:大致说来:

  • The size of a correlation coefficient ( 0.41 ) suggests a low positive correlation.相关系数 ( 0.41 ) 的大小表明低正相关。
  • p-value ( 5e-18 ) suggests that the correlation coefficient is statistically significant, being much less than 0.01 (0.01 ---> the risk of concluding that a correlation exists when, actually, no correlation exists is 1%). p 值 ( 5e-18 ) 表明相关系数具有统计显着性,远小于 0.01(0.01 ---> 在实际上不存在相关性时得出相关性存在的风险为 1%)。
  • please, remember that Pearson correlation coefficient only measures linear relationships.请记住,皮尔逊相关系数仅衡量线性关系。 You can get Pearson correlation coefficient 0 for variables (datasets) with a strong nonlinear relationship.对于具有强非线性关系的变量(数据集),您可以获得 Pearson 相关系数0 Moreover, you are assuming that your variables (datasets) are normally distributed.此外,您假设您的变量(数据集)是正态分布的。

Also if I want to just display pearsonr on the plot, how should I change my code.另外,如果我只想在绘图上显示 pearsonr,我应该如何更改我的代码。

seaborn 0.9.0 does not display that information. seaborn 0.9.0不显示该信息。 To add that information, you can compute the value using scipy.stats.pearsonr , then showing it as part of the title of your figure.要添加该信息,您可以使用scipy.stats.pearsonr计算该值,然后将其显示为图形标题的一部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM