Skip to content

ENH: stats based on (fixed percent) trimmed samples #6459

Closed

Description

@josef-pkt

I don't find an issue

trimming obsevations like 20% on both tails makes t-test and similar more robust to outliers and to some extend to non-normality of distributions.

popularized (mainly in Psychology) by Randy Wilcox, articles and text book

scipy has some functions for it

Yuen's t-test ttest_trimmed open PR scipy/scipy#9678
Brown-Forsythe trimmed anova for equality of variances/dispersion
I found an old script #866 (comment)
it also includes a one-sample class, similar to the one in weightstats

class TrimmedMean(object):
    '''class for trimmed and winsorized one sample statistics'''

For k-sample comparison, the version would be a yuen anova or yuen-welsh anova

Activity

  1. josef-pkt commented on Jan 22, 2020

    @josef-pkt
    MemberAuthor

    and "Don't log-transform - use GLM" for psychologists

    Ng, Victoria K. Y., and Robert A. Cribbie. 2019. “The Gamma Generalized Linear Model, Log Transformation, and the Robust Yuen-Welch Test for Analyzing Group Means with Skewed and Heteroscedastic Data.” Communications in Statistics - Simulation and Computation 48 (8): 2269–86. https://doi.org/10.1080/03610918.2018.1440301.

    They argue against using trimming, Yuen-Welsh, or endog transformation like log or Box-Cox when data is heteroscedastic and skewed, in favor of GLM.
    #2791 for what we can do if we log transform, but I don't see a FAQ issue with the econ literature on using GLM/Poisson instead of log-transforming endog, partially in #4276

  2. josef-pkt commented on Jan 22, 2020

    @josef-pkt
    MemberAuthor

    one point for implementation

    anova, Welch, Yuen, Yuen- Welch anova for mean and their counterparts for variance/dispersion like Levene, Brown-Forsythe, share the same underlying anova computation, equivalent to a model like OLS or GLM with one categorical exog.

    inference, distribution for test statistics might differ, if we don't want just generic asymptotic chisquare.

  3. josef-pkt commented on Jan 22, 2020

    @josef-pkt
    MemberAuthor

    related: rank based methods.
    Without ties using rank transformed data in generic anova or t-test should be equivalent to their nonparametric counterparts.
    I'm not sure about tie handling in the generic case.

    Where do we put these functions and what API?

  4. josef-pkt commented on Jan 22, 2020

    @josef-pkt
    MemberAuthor

    pushed my 2013 branch, not rebased and updated yet
    master...josef-pkt:stats_robust

  5. josef-pkt commented on Jan 22, 2020

    @josef-pkt
    MemberAuthor

    I think I remember why I gave up in 2013
    scipy.stats.levene includes the dispersion version, including median and trimmed mean as center, and allows for k-sample comparison.

    Brown-Forsythe is just levene with mean replaced by median,

    center : {‘mean’, ‘median’, ‘trimmed’}, optional
    Which function of the data to use in the test. The default is ‘median’.
    
    proportiontocut : float, optional
    When center is ‘trimmed’, this gives the proportion of data points to cut from each end. (See scipy.stats.trim_mean.) Default is 0.05.
    
  6. josef-pkt commented on Feb 14, 2020

    @josef-pkt
    MemberAuthor

    I guess I will resurrect this so we can also add equivalence tests #6444 both for mean comparisons and for variance comparisons, and possibly for adding effect size measures and more power/sample size functions.

    One possibility is to add anova style methods to a stats\_oneway.py (or not private) that could include one-way anova style methods for both mean and variances together.
    Related module would be multicomp for the pairwise multiple comparisons, and k-sample tests by type of variable, continuous, proportion, rates/count.

  7. josef-pkt commented on Feb 18, 2020

    @josef-pkt
    MemberAuthor

    scipy.stats and statsmodels don't have Welch Anova (at least I don't find them searching for "Welch")

  8. josef-pkt commented on Feb 26, 2020

    @josef-pkt
    MemberAuthor

    another one

    https://www.rdocumentation.org/packages/equivalence/versions/0.7.2/topics/rtost
    TOST two sample t-test based on trimmed sample, ie yuen t-tost or tostt
    (I don't have two sample tests in #6526 yet)

  9. added this to the 0.12 milestone on Jul 27, 2020
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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions