animator / learn-python

📖🐍 Free & Open Source book to master Python 3. Also available: PDF & Web Interface.
https://animator.github.io/learn-python/
Creative Commons Attribution Share Alike 4.0 International
324 stars 213 forks source link

Correlation Tests #1304

Open ranamanish674zu opened 6 days ago

ranamanish674zu commented 6 days ago

PR Description

fixes #1299 Pearson Correlation Coefficient (r) measures the linear relationship between two continuous variables. It ranges from -1 to 1, where -1 indicates a perfect negative linear relationship, 1 indicates a perfect positive linear relationship, and 0 indicates no linear relationship. Pearson's correlation assumes that the data are normally distributed and have a linear relationship with homoscedasticity (constant variance of the error terms).

Spearman's Rank Correlation Coefficient (ρ or rs) measures the strength and direction of the monotonic relationship between two variables, which can be ordinal, interval, or continuous. It is based on the ranks of the data rather than the raw data itself and ranges from -1 to 1, with the same interpretation as Pearson's correlation. Spearman's correlation does not assume normal distribution or linearity and is used when data are not normally distributed or when the relationship is not linear.

Related Issues

Checklist

Undertaking

I declare that:

  1. The content I am submitting is original and has not been plagiarized.
  2. No portion of the work has been copied from any other source without proper attribution.
  3. The work has been checked for plagiarism, and I assure its authenticity.

I understand that any violation of this undertaking may have legal consequences that I will bear and could result in the withdrawal of any recognition associated with the work.

ranamanish674zu commented 5 days ago

@animator could you please review it