-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
ENH: stats: add dunnett_from_stats
#20706
base: main
Are you sure you want to change the base?
Conversation
…ulticomp module. Dunnett's test can be performed if the means, standard deviations and sample counts are known. In this respect dunnett_from_stats() is to dunnett() as ttest_ind_from_stats() is to ttest_ind() Added tests to test_multicomp. Most of these replicate existing tests for dunnett function. For test_dunnett_from_stats_raises, there are new tests logically different from those for dunnett function. Moved `test_warnings()` to the end because logically it is different from other tests. This one tests that the DunnettTests object's method behave in expected manner given specific input
Thanks. Can you open an issue and make a post at https://discuss.scientific-python.org/c/contributor/scipy/32 to discuss such functions more broadly? Almost every function in stats could conceivably have a separate For example, I have noticed that some separation of functions that compute statistics from those that compute p-values would be beneficial. Objects returned by some tests contain a method that computes confidence intervals because CIs are not always needed. From that perspective, why is the p-value an attribute? Sometimes - like when you want to do a Monte Carlo or resampling version of a test - you only need the statistic and not the p-value. As this PR indicates, sometimes you don't need a function to go through the entire statistic calculation when summary statistics are available. In the long run, I'd like to move toward an interface that satisfies these different needs in a unified way. What I've had in mind would involve objects with separate methods for the different outputs one might need. Perhaps there would be multiple ways of instantiating these objects - not just from raw data, but also from summary statistics. The two halves can be decoupled, of course; that is, existing hypothesis test functions could begin to accept summary statistics as input. For example, instead of an array for each sample, one could provide a tuple of essential summary statistics or What do you think of discussing these needs more broadly before adding this function? |
Thank you, @mdhaber! I see the good sense in that. Admittedly, this is* my first rodeo - contributing to an open source project. And I want to help lay out a generic refactoring template (as you outline) so even other tests can subsequently be modified to work solely using summary stats where applicable. But I am worried that I will not be able to commit enough time to finish this refactor in a reasonable timeframe. With this perspective, could you please give me a sense of how this broader discussion may go? Is it for me to get guidance on specifics of how best to refactor? Or is it to break this refactoring initiative into smaller tasks so different individuals can contribute? Or something else? |
Both of these. Let's ignore what I said about breaking up the tests into parts that calculate the statistic / p-value / CI - consider it to be background context that's been on my mind for a while. Here's what I'd suggest if you're interested:
Does that sound manageable? Sorry it's not as simple as just merging this PR, but I think it's important to look ahead a bit! |
Understood. Thank you very much for these thoughtful responses! Potentially all parametric tests can benefit from such an option where either raw data or summary stats can be fed in (like function overloading - but handled within the same function definition). I use Scipy a fair amount and feel obliged to help make this transition - especially since this kind of an interface will be more friendly for use in high volume experiments to test for small effects. Unfortunately, I cannot spare a predictable amount of time regularly for the next 3 months or so. I could perhaps take this up starting in August or September 2024 as my pet project. |
dunnett_from_stats
Dunnett's test can be performed even if only the means, standard deviations and sample counts are known. In this respect
dunnett_from_stats()
is todunnett()
asttest_ind_from_stats()
is tottest_ind()
.dunnett_from_stats
will be especially useful when dealing with large volume experiments (eg: in online advertising) where the measurements for each observation are not available but the summary statistics are available.Added tests to test_multicomp. Most of these replicate existing tests for dunnett function. For
test_dunnett_from_stats_raises
, there are new tests logically different from those for dunnett function.Moved
test_warnings()
to the end because logically it is different from other tests. This one tests that the DunnettTests object's method behave in expected manner given specific inputReference issue
What does this implement/fix?
Additional information