From the following link:



This is done in 2 steps:

  1. The correlation between each regressor and the target is computed, that is, ((X[:, i] - mean(X[:, i])) * (y - mean_y)) / (std(X[:, i]) * std(y)).
  2. It is converted to an F score then to a p-value.

I can't seem to find information about how one would convert a correlation between $x_i, y$ into an F score though.


If you know the correlation coefficient, the square of that gives coefficient of determination $R^2$ which gives the explained variance over total variance. From there, you can work out the F.

Using an anova table :

enter image description here

If we know $R^2$ , which is SRR / SSTO , then 1- $R^2$ gives us SSE / SSTO . To get an F score, we can do $R^2$ / (($1 - R^2$) / (n-2)) since the denominator will cancel out.

In the source code:

# convert to p-value
degrees_of_freedom = y.size - (2 if center else 1)
F = corr ** 2 / (1 - corr ** 2) * degrees_of_freedom
pv = stats.f.sf(F, 1, degrees_of_freedom)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.