class_docstr: class for runs in a binary sequence
  
  
  Parameters
  ----------
  x : array_like, 1d
      data array,
  
  
  Notes
  -----
  This was written as a more general class for runs. This has some redundant
  calculations when only the runs_test is used.
  
  TODO: make it lazy
  
  The runs test could be generalized to more than 1d if there is a use case
  for it.
  
  This should be extended once I figure out what the distribution of runs
  of any length k is.
  
  The exact distribution for the runs test is also available but not yet
  verified.
code: def __init__(self, x):
      self.x = np.asarray(x)
  
      self.runstart = runstart = np.nonzero(
          np.diff(np.r_[[-np.inf], x, [np.inf]])
      )[0]
      self.runs = runs = np.diff(runstart)
      self.runs_sign = runs_sign = x[runstart[:-1]]
      self.runs_pos = runs[runs_sign == 1]
      self.runs_neg = runs[runs_sign == 0]
      self.runs_freqs = np.bincount(runs)
      self.n_runs = len(self.runs)
      self.n_pos = (x == 1).sum()
  
imports: import numpy
  from scipy import stats
  from scipy.special import comb
  import warnings
  from statsmodels.tools.validation import array_like
label_desc: Use image node_id 1 to create a new Runs object  with example: obj = Runs(x)