Skip to content

ENH: tukeyhsd, pairwise comparison from summary statistics #4570

Open

Description

@josef-pkt

https://stackoverflow.com/questions/50070927/anova-table-and-pairwise-test

tukey-hsd based on mean and var/std as sufficient statistics.

I have not looked at it, but this should be made possible and easy to add, for one way anova

related
#4379 tukey-hsd improvements
#4323 discussion of two way anova

Activity

  1. added this to the 0.10 milestone on Apr 29, 2018
  2. sadepu1915 commented on Jun 30, 2019

    @sadepu1915

    is anyone working on it ?

  3. g-simmons commented on Jul 24, 2019

    @g-simmons

    Just in case anyone is in need of a quick hack, this worked for me. Output is a tuple instead of TukeyHSDResults. For some reason putting the vector of variances directly into tukeyhsd() gave crazy results, only works when var_all is a scalar.

    import numpy as np
    
    def tukey_from_summary(means,stdevs,ns,alpha=.05):
        from statsmodels.sandbox.stats.multicomp import tukeyhsd
    
        variances = stdevs**2
        pooled_var = sum(np.multiply(variances,(ns-1)))/sum(ns-1)
        res = tukeyhsd(mean_all=means, nobs_all=ns, var_all=pooled_var, alpha=alpha, q_crit=None)
        
        return res
    
  4. modified the milestones: 0.10, 0.14 on Sep 5, 2022
  5. josef-pkt commented on Sep 5, 2022

    @josef-pkt
    MemberAuthor

    putting the vector of variances directly into tukeyhsd() gave crazy results, only works when var_all is a scalar.

    sounds like a bug
    There were some bugs in my initial var correction functions. Maybe they have not all been fixed.

  6. modified the milestones: 0.14, 0.15 on Dec 5, 2022
  7. josef-pkt commented on Dec 5, 2022

    @josef-pkt
    MemberAuthor

    check during refactoring #8396

    helper functions like var computation need more unit tests, and possibly removal of code duplication.

  8. josef-pkt commented on Jan 21, 2025

    @josef-pkt
    MemberAuthor

    statsmodels.sandbox.stats.multicomp.tukeyhsd does not have proper docstring
    return is a messy tuple

    This was not intended for public usage.
    We need a "from stats" function that has clean interface.

    possibly add variance equal/unequal option to compute pooled or pairwise variances.

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions