Skip to content

ENH: power for Welch's ANOVA, unequal variance #6496

Open

Description

@josef-pkt

We have one version of power computation for one-way ANOVA FTestAnovaPower.
This can be extended or complemented with power under the assumption that variance is not the same across groups.

Jan, Show-Li, and Gwowen Shieh. 2014. “Sample Size Determinations for Welch’s Test in One-Way Heteroscedastic ANOVA.” British Journal of Mathematical and Statistical Psychology 67 (1): 72–93. https://doi.org/10.1111/bmsp.12006.

looks good, but I didn't check the simulations


related aside:
Docs for FTestAnovaPower are not very good, e.g. I have no idea anymore how to use it and how to compute effectsize for anova.
The class has a special method _solve_effect_size which is still labeled as "experimental". I don't know if there are problems left with rootfinding using current scipy.

update
FTestAnovaPower has unit test against a GPower example
http://www.psychologie.hhu.de/fileadmin/redaktion/Fakultaeten/Mathematisch-Naturwissenschaftliche_Fakultaet/Psychologie/AAP/gpower/GPowerManual.pdf p.25
effect size is Cohen's f which is sqrt(variance_between / variance_within)
assumes homogeneous variance, equal sample size in power computation (or hidden in effect size)
PASS also seems to have only homogeneous variance versions for anova power

Activity

  1. josef-pkt commented on Mar 12, 2020

    @josef-pkt
    MemberAuthor

    power for Welch anova equivalence testing
    #6444 (comment)
    another article by the same authors as above using the welch f-statistic without welch correction as effect size measure
    Currently I use squared versions, i.e. f^2 analogues instead of sqrt versions like f

    I'm working on continuation for oneway methods in #6526

  2. josef-pkt commented on Mar 12, 2020

    @josef-pkt
    MemberAuthor

    For equivalence testing we need the non-central distribution under the null.
    This is the analogue of having a non-zero value (diff or margin) in the one or two sample tests.

    Standard anova or joint hypothesis tests only allow for null of no difference.
    Current FTestAnovaPower hardcodes the all mean equal null in function
    ftest_anova_power in computing critical value for rejection region

        crit = stats.f.isf(alpha, df_denom, df_num)
        pow_ = stats.ncf.sf(crit, df_denom, df_num, effect_size**2 * nobs)
    

    for oneway equivalence I need

    crit_f = stats.ncf.ppf(alpha, df[0], df[1], nobs_mean * eps**2)
    p = stats.ncf.cdf(crit_f, df[0], df[1], nobs_mean * eps_a**2)
    
  3. josef-pkt commented on Mar 12, 2020

    @josef-pkt
    MemberAuthor

    Implementation: computational efficiency versus flexibility and DRYness

    current t-test and F-test anova power compute df in the power function.

    For variants of anova like welch, the computations are more involved and I am currently (#6526) computing this in the hypothesis test functions with several options. I can reuse intermediate results that are returned.

    The alternative would be to compute all relevant statistics, like satterthwaite df inside the power function, but that would duplicate code and I need to add anova options.

    Another alternative would be to switch to a class that has reusable methods and stores intermediate results that don't need to be recomputed each time.

    Similar question: where do we compute "effect size" under the alternative?

    Show-Li and Shieh. 2014 mention that there are no references for power computation for Brown-Forsythe and James version of anovas, and I haven't looked for power for yuen trimmed anova yet.
    So, I'm not sure I will get power computation for all variants of anovas that I have currently in the PR.

  4. josef-pkt commented on Mar 12, 2020

    @josef-pkt
    MemberAuthor

    related to t-test:

    current ttest_power has an optional df argument, but not a ddof
    df is a function of the sample size, default df = nobs - 1

    This doesn't work if we want to use satterthwaite degrees of freedom in a Welch heteroscedastic t_test.

    i.e. power, sample size and effect size for Welch t-test are currently not supported

  5. josef-pkt commented on Mar 12, 2020

    @josef-pkt
    MemberAuthor

    sequence (approximately the current version)

      1. use oneway_generic to compute effect size and critical value (rejection region) under the Null
      1. use oneway_generic to compute effect size and other statistics under the alternative that do not depend on sample size.
      1. for each or given nobs, compute df using oneway_generic or specific code), and use it to compute power.

    It's more complicated, if we want to solve for other parameters than power or sample size, e.g. for (minimal detectable) effect size.
    In that case 2. and 3. might need to be inside the function for the root solver.
    Or maybe not, we just solve for cohen's f or analogue, which would be invariant given allocation ratio (sample size distribution across groups) and given fixed variances within groups.

    current FTestAnovaPower has _solve_effect_size, for Cohen's f but code comment says there can be problems with root finding.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions