-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
statistics: add covariance, Pearson's correlation, and simple linear regression #82671
Comments
Covariance and Pearson's correlation are one of the most basic bivariate statistics. https://en.wikipedia.org/wiki/Covariance |
These two functions are right on the boundary edge of what the statistics module is trying to do, """The module is not intended to be a competitor to third-party libraries such as NumPy, SciPy, or proprietary full-featured statistics packages aimed at professional statisticians such as Minitab, SAS and Matlab. It is aimed at the level of graphing and scientific calculators.""" It is debatable which side of the boundary they belong to. MS Excel has both of these functions, but it isn't a given that a scientific calculator would have them. Also, the current functions require only high-school level knowledge, but these two require more skill to learn, use, and interpret. |
I think I see your point, that the module is intended for the most basic Correlation and covariance can be thought as equivalents for standard TL;DR those are basic statistics. They would make the module much more Tim śr., 16 paź 2019 o 02:50 Raymond Hettinger <report@bugs.python.org>
|
I can't speak for other countries, but in Australia, secondary school On the other hand, other calculators such as the HP-48GX do. Oddly, Excel provides the population (not sample) covariance: https://support.office.com/en-us/article/COVARIANCE-P-function-6F0E1E6D-956D-4E4B-9943-CFEF0BF9EDFC OpenOffice and LibreOffice also provide a covariance function. I think that supporting correlation coefficient
|
In case there is agreement with Steven, I will add simple linear regression slope = correlation(x, y) * ( stdev(y) / stdev(x) )
intercept = mean(y) - slope * mean(x) As about covariance, I see your points, but why not keeping it "because we On Wed, Oct 16, 2019 at 10:47 AM Steven D'Aprano <report@bugs.python.org>
|
I expanded my PR to add simple linear regression. I also created As about covariance, we can simply not expose it to the users, but I'm not Tim On Wed, Oct 16, 2019 at 11:25 AM Tymek Wołodźko <report@bugs.python.org>
|
I'm in favor of adding all of this (covariance, coefficient, linear regression). It's still at the level of elementary statistics, and even taught in watered down "business statistics" classes. It's about the minimum that can be done beyond single-variable stats. But I also think this defines the limit of what the core "should" include in this area. |
@steven.daprano and @tim.peters, please take a look at the PR as it is just waiting on your approval. Thanks! |
Is there anything more I should do about the PR? Sincerely, On Fri, May 22, 2020 at 10:45 PM Cheryl Sabella <report@bugs.python.org>
|
Given the discussion here and the state of the attached PR, I intend to merge the PR in several weeks, unless someone has anything else to say. |
Thanks for the suggestion, PR, and great heaps of patience and perseverance, Tymek! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: