class_docstr: Tests for multiple comparisons
  
  Parameters
  ----------
  data : ndarray
      independent data samples
  groups : ndarray
      group labels corresponding to each data point
  group_order : list[str], optional
      the desired order for the group mean results to be reported in. If
      not specified, results are reported in increasing order.
      If group_order does not contain all labels that are in groups, then
      only those observations are kept that have a label in group_order.
class_docstr_tok: ["Tests","for","multiple","comparisons","Parameters","--","--","--","--","--","data",":","ndarray","independent","data","samples","groups",":","ndarray","group","labels","corresponding","to","each","data","point","group_order",":","list","[","str","]",",","optional","the","desired","order","for","the","group","mean","results","to","be","reported","in",".","If","not","specified",",","results","are","reported","in","increasing","order",".","If","group_order","does","not","contain","all","labels","that","are","in","groups",",","then","only","those","observations","are","kept","that","have","a","label","in","group_order","."]
docstr: run a pairwise test on all pairs with multiple test correction
  
  The statistical test given in testfunc is calculated for all pairs
  and the p-values are adjusted by methods in multipletests. The p-value
  correction is generic and based only on the p-values, and does not
  take any special structure of the hypotheses into account.
  
  Parameters
  ----------
  testfunc : function
      A test function for two (independent) samples. It is assumed that
      the return value on position pvalidx is the p-value.
  alpha : float
      familywise error rate
  method : str
      This specifies the method for the p-value correction. Any method
      of multipletests is possible.
  pvalidx : int (default: 1)
      position of the p-value in the return of testfunc
  
  Returns
  -------
  sumtab : SimpleTable instance
      summary table for printing
  
  errors:  TODO: check if this is still wrong, I think it's fixed.
  results from multipletests are in different order
  pval_corrected can be larger than 1 ???
docstr_tok: ["run","a","pairwise","test","on","all","pairs","with","multiple","test","correction","The","statistical","test","given","in","testfunc","is","calculated","for","all","pairs","and","the","p-values","are","adjusted","by","methods","in","multipletests",".","The","p-value","correction","is","generic","and","based","only","on","the","p-values",",","and","does","not","take","any","special","structure","of","the","hypotheses","into","account",".","Parameters","--","--","--","--","--","testfunc",":","function","A","test","function","for","two","(","independent",")","samples",".","It","is","assumed","that","the","return","value","on","position","pvalidx","is","the","p-value",".","alpha",":","float","familywise","error","rate","method",":","str","This","specifies","the","method","for","the","p-value","correction",".","Any","method","of","multipletests","is","possible",".","pvalidx",":","int","(","default",":","1",")","position","of","the","p-value","in","the","return","of","testfunc","Returns","--","--","--","-","sumtab",":","SimpleTable","instance","summary","table","for","printing","errors",":","TODO",":","check","if","this","is","still","wrong",",","I","think","it","'s","fixed",".","results","from","multipletests","are","in","different","order","pval_corrected","can","be","larger","than","1","?","?","?"]
code: def allpairtest(self, testfunc, alpha=0.05, method="bonf", pvalidx=1):
      """run a pairwise test on all pairs with multiple test correction
  
      The statistical test given in testfunc is calculated for all pairs
      and the p-values are adjusted by methods in multipletests. The p-value
      correction is generic and based only on the p-values, and does not
      take any special structure of the hypotheses into account.
  
      Parameters
      ----------
      testfunc : function
          A test function for two (independent) samples. It is assumed that
          the return value on position pvalidx is the p-value.
      alpha : float
          familywise error rate
      method : str
          This specifies the method for the p-value correction. Any method
          of multipletests is possible.
      pvalidx : int (default: 1)
          position of the p-value in the return of testfunc
  
      Returns
      -------
      sumtab : SimpleTable instance
          summary table for printing
  
      errors:  TODO: check if this is still wrong, I think it's fixed.
      results from multipletests are in different order
      pval_corrected can be larger than 1 ???
      """
      res = []
      for i, j in zip(*self.pairindices):
          res.append(testfunc(self.datali[i], self.datali[j]))
      res = np.array(res)
      reject, pvals_corrected, alphacSidak, alphacBonf = multipletests(
          res[:, pvalidx], alpha=alpha, method=method
      )
      # print(np.column_stack([res[:,0],res[:,1], reject, pvals_corrected])
  
      i1, i2 = self.pairindices
      if pvals_corrected is None:
          resarr = np.array(
              lzip(
                  self.groupsunique[i1],
                  self.groupsunique[i2],
                  np.round(res[:, 0], 4),
                  np.round(res[:, 1], 4),
                  reject,
              ),
              dtype=[
                  ("group1", object),
                  ("group2", object),
                  ("stat", float),
                  ("pval", float),
                  ("reject", np.bool_),
              ],
          )
      else:
          resarr = np.array(
              lzip(
                  self.groupsunique[i1],
                  self.groupsunique[i2],
                  np.round(res[:, 0], 4),
                  np.round(res[:, 1], 4),
                  np.round(pvals_corrected, 4),
                  reject,
              ),
              dtype=[
                  ("group1", object),
                  ("group2", object),
                  ("stat", float),
                  ("pval", float),
                  ("pval_corr", float),
                  ("reject", np.bool_),
              ],
          )
      results_table = SimpleTable(resarr, headers=resarr.dtype.names)
      results_table.title = (
          "Test Multiple Comparison %s \n%s%4.2f method=%s"
          % (testfunc.__name__, "FWER=", alpha, method)
          + "\nalphacSidak=%4.2f, alphacBonf=%5.3f"
          % (alphacSidak, alphacBonf)
      )
  
      return (
          results_table,
          (res, reject, pvals_corrected, alphacSidak, alphacBonf),
          resarr,
      )
  
imports: from collections import namedtuple
  from statsmodels.compat.python import lzip, lrange
  import copy
  import math
  import numpy
  from numpy.testing import assert_almost_equal, assert_equal
  from scipy import stats, interpolate
  from statsmodels.iolib.table import SimpleTable
  from statsmodels.stats.multitest import multipletests, _ecdf, fdrcorrection, fdrcorrection_twostage
  from statsmodels.graphics import utils
  from statsmodels.tools.sm_exceptions import ValueWarning
label_desc: Use image node_id 4 for calling the MultiComparison obj's underlying member method code with example usage: obj.allpairtest(testfunc, alpha, method, pvalidx) and returns: results_table,  res,  reject,  pvals_corrected,  alphacSidak,  alphacBonf,  resarr