3

I have a dataset where I need to perform Tukey_test on multiple variables instead of pair-wise comparison:

My data looks like:

Subject    State     Type   Success
   A        AZ        1        0.89
   B        TX        2        0.91
   C        NJ        3        0.78
   A        OH        4        0.91

My code:

from statsmodels.stats.multicomp import pairwise_tukeyhsd
from statsmodels.formula.api import ols
from statsmodels.base.model import Model

p1_tukey_test = pairwise_tukeyhsd(data["Success"], data["Subject"] )
f.write("\n\n" + str(p1_tukey_test._results_table))

My output:

  ===================================================================
  group1        group2         meandiff     lower      upper     reject
   ---------------------------------------------------------------------
    A              B            13.8883      12.493    15.2835   True 
    A              C            10.2884      8.5795    11.9972   True 

I want to have the output be like:

===================================================================
  group1        group2  group3       meandiff     lower      upper     reject
   ---------------------------------------------------------------------
 A               B        C            13.8883     12.493    15.2835   True

In other words , I dont want to have pairwise comparison rather I want to compare overall results for each category of Subject variable

TjS
  • 277
  • 2
  • 5
  • 16
  • The distribution of the TukeyHSD test statistic is specific to pairwise comparisons of independent samples. You could use wald_test after OLS for the individual joint hypothesis, and then use one of the pvalue corrections for multiple testing. It's not clear what hypothesis or contrast you want to test for "overall results for each category", – Josef Dec 18 '18 at 16:18
  • Can you suggest by an the answer? I have multiple categories in 'Subject', what I want to o is, I want to check if there exists a correlation between Subject and Sucess by hypothesis testing ad return the specifcvalue of Subject, which means Exmple: I could say that the highest success is observed when subject was 'A' – TjS Dec 18 '18 at 16:37

0 Answers0