Skip to content

Sample Size Needed to Compare k Proportions #796

Open

Description

@michaelamoako

Is your feature request related to a problem? Please describe.

In many use-cases, it would be valuable to understand the sample size needed to understand the statistical significance of a disparity (or lack thereof) between two groups. Calculators like: http://powerandsamplesize.com/Calculators/Compare-k-Proportions/1-Way-ANOVA-Pairwise

Offer a manual procedure and a formula. I believe that the calculations above can be useful in helping Fairlearn users understand if their sample size is big enough to draw conclusions about the comparison between the proportion values (i.e: FPR, TPR, FNR, TNR) of different groups

Describe the solution you'd like

A function that takes in the subgroups, the proportion values, and performs the powerandsample size calculations (linked above), to output the sample sizes need in each pairwise comparison.

Describe alternatives you've considered, if relevant

Using the power and samplesize calculator manually

Additional context

Activity

  1. romanlutz commented on May 10, 2021

    @romanlutz
    Member

    This is very useful. A first step (that's not nearly as sophisticated, of course) towards understanding whether we have enough data is #737 , but I definitely agree that we should go beyond that.

  2. added
    enhancement
    on May 10, 2021
  3. hildeweerts commented on May 11, 2021

    @hildeweerts
    Contributor

    I like the idea of having a tool that helps people think about sample sizes. However, I am always a bit cautious with recommending statistical tests for other purposes than statistical testing in a scientific study. The results can become misleading if the tools aren't used properly. So I'd like to make sure that we write proper documentation for this function.

    For example, if you compute the sample sizes for multiple sensitive features, you'd need to correct alpha to account for multiple testing (i.e., in addition to the correction that's inherent in the post-hoc ANOVA itself). I also believe that a power analysis is supposed to be computed based on the theoretical effect size of interest, rather than the observed effect size (see e.g., this blog). In our scenario, I think that means that you need to define the difference in proportions you would deem relevant (which is a hard context-dependent question, but one you need to answer anyways).

    Anyways, I wouldn't call myself a statistics expert, so it would be nice if we can involve more experienced folks to ensure we have the proper documentation to guide people who don't know much about stats at all.

  4. michaelamoako commented on May 11, 2021

    @michaelamoako
    ContributorAuthor

    Agreed @hildeweerts . I think the same can be said of Error Bars too (tagged you in that issue)

  5. riedgar-ms commented on May 14, 2021

    @riedgar-ms
    Member

    Like with the error bars, I think that this is a case where we shouldn't be trying to do this within Fairlearn (for the reasons @hildeweerts outlines), but we should be making sure that we support users applying the appropriate statistical tests themselves. Part of that would be some worked examples with different statistical tests (along with a note as to why the particular statistical test is appropriate, without a digression into a full course on statistics).

  6. romanlutz commented on Jul 8, 2021

    @romanlutz
    Member

    What's a good way forward here?
    @riedgar-ms for the error bars you presumably use another package to calculate the bounds, right? Can't we do the same for these tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions