class_docstr: a class for step down methods
  
  This is currently for simple tree subset descend, similar to homogeneous_subsets,
  but checks all leave-one-out subsets instead of assuming an ordered set.
  Comment in SAS manual:
  SAS only uses interval subsets of the sorted list, which is sufficient for range
  tests (maybe also equal variance and balanced sample sizes are required).
  For F-test based critical distances, the restriction to intervals is not sufficient.
  
  This version uses a single critical value of the studentized range distribution
  for all comparisons, and is therefore a step-down version of Tukey HSD.
  The class is written so it can be subclassed, where the get_distance_matrix and
  get_crit are overwritten to obtain other step-down procedures such as REGW.
  
  iter_subsets can be overwritten, to get a recursion as in the many to one comparison
  with a control such as in Dunnet's test.
  
  
  A one-sided right tail test is not covered because the direction of the inequality
  is hard coded in check_set.  Also Peritz's check of partitions is not possible, but
  I have not seen it mentioned in any more recent references.
  I have only partially read the step-down procedure for closed tests by Westfall.
  
  One change to make it more flexible, is to separate out the decision on a subset,
  also because the F-based tests, FREGW in SPSS, take information from all elements of
  a set and not just pairwise comparisons. I have not looked at the details of
  the F-based tests such as Sheffe yet. It looks like running an F-test on equality
  of means in each subset. This would also outsource how pairwise conditions are
  combined, any larger or max. This would also imply that the distance matrix cannot
  be calculated in advance for tests like the F-based ones.
class_docstr_tok: ["a","class","for","step","down","methods","This","is","currently","for","simple","tree","subset","descend",",","similar","to","homogeneous_subsets",",","but","checks","all","leave-one-out","subsets","instead","of","assuming","an","ordered","set",".","Comment","in","SAS","manual",":","SAS","only","uses","interval","subsets","of","the","sorted","list",",","which","is","sufficient","for","range","tests","(","maybe","also","equal","variance","and","balanced","sample","sizes","are","required",")",".","For","F-test","based","critical","distances",",","the","restriction","to","intervals","is","not","sufficient",".","This","version","uses","a","single","critical","value","of","the","studentized","range","distribution","for","all","comparisons",",","and","is","therefore","a","step-down","version","of","Tukey","HSD",".","The","class","is","written","so","it","can","be","subclassed",",","where","the","get_distance_matrix","and","get_crit","are","overwritten","to","obtain","other","step-down","procedures","such","as","REGW",".","iter_subsets","can","be","overwritten",",","to","get","a","recursion","as","in","the","many","to","one","comparison","with","a","control","such","as","in","Dunnet","'s","test",".","A","one-sided","right","tail","test","is","not","covered","because","the","direction","of","the","inequality","is","hard","coded","in","check_set",".","Also","Peritz","'s","check","of","partitions","is","not","possible",",","but","I","have","not","seen","it","mentioned","in","any","more","recent","references",".","I","have","only","partially","read","the","step-down","procedure","for","closed","tests","by","Westfall",".","One","change","to","make","it","more","flexible",",","is","to","separate","out","the","decision","on","a","subset",",","also","because","the","F-based","tests",",","FREGW","in","SPSS",",","take","information","from","all","elements","of","a","set","and","not","just","pairwise","comparisons",".","I","have","not","looked","at","the","details","of","the","F-based","tests","such","as","Sheffe","yet",".","It","looks","like","running","an","F-test","on","equality","of","means","in","each","subset",".","This","would","also","outsource","how","pairwise","conditions","are","combined",",","any","larger","or","max",".","This","would","also","imply","that","the","distance","matrix","can","not","be","calculated","in","advance","for","tests","like","the","F-based","ones","."]
docstr: studentized range statistic
docstr_tok: ["studentized","range","statistic"]
code: def get_distance_matrix(self):
      """studentized range statistic"""
      # make into property, decorate
      dres = distance_st_range(
          self.vals, self.nobs_all, self.var_all, df=self.df
      )
      self.distance_matrix = dres[0]
  
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 3 for calling the StepDown obj's underlying member method code with example usage: obj.get_distance_matrix() without return types