Statistical meaning of pearsonr() output in Python

I have calculated the Pearson correlation by using

pearsonr(var1, var2)


I understand that the first number is the Pearson correlation and the second number is the significance.

I have a few questions:

• Above which value can we consider significant correlation?
• Is the R-square only R**2?
• How do I calculate the adjusted R square?

1 Answer

1. The second number is the p value. It can be interpreted as the probability to observe a correlation that extreme in the sample (i.e. that high if it is positive or that low if it is negative) if the true correlation was 0. A low value therefore correspond to stronger evidence that the correlation is different from 0 and you can perform a test by checking if the p value is under (not above) the threshold. Note that there are several ways to test if a correlation coefficient is different from 0 (see Can p-values for Pearson's correlation test be computed just from correlation coefficient and sample size? and in particular the reference provided by Nick Cox in the comments).

What that threshold should be is really up to you and could in principle be determined based on how important it is not to commit an error and how much power your experiment has. In many scientific disciplines (psychology, biomedicine and neuroscience, possibly economics), the error level is routinely set to 5% (i.e. a p value under .05) and you would call anything under that threshold “statistically significant”. In physics and engineering, the threshold is sometimes much lower (five or six “sigmas”). See also Examples of studies using p < 0.001, p < 0.0001 or even lower p-values? and Comparing and contrasting, p-values, significance levels and type I error

2. Yes, for a simple linear regression with one predictor and an intercept, $r * r$ is really an estimate of $R^2$. Of course, your code is not explicitly fitting a model or anything but there is a link between the Pearson product-moment correlation, this simple linear model and different other tests. It becomes more complicated if the model includes several predictors (see Regression $R^2$ and correlations).

3. Adjusted $R^2$ is adjusted to take the number of parameters into account (a model with more parameters can be expected to better predict the data in the sample even if the additional variables aren't really useful). There is a formula in Wikipedia and several earlier questions on this: How to choose between the different Adjusted $R^2$ formulas?, Why is adjusted R-squared less than R-squared if adjusted R-squared predicts the model better?. If you read more on that, you will notice that there is in fact quite a lot of discussion on how to adjust $R^2$ and the usefulness of these coefficients in practice.

You can apparently get an adjusted $R^2$ directly in Python/SciPy using the ols.ols() function, see http://wiki.scipy.org/Cookbook/OLS