def expected_h(nvals, fit="RANSAC"):
  """
  Uses expected_rs to calculate the expected value for the Hurst exponent h
  based on the values of n used for the calculation.

  Args:
    nvals (iterable of int):
      the values of n used to calculate the individual (R/S)_n

  KWargs:
    fit (str):
      the fitting method to use for the line fit, either 'poly' for normal
      least squares polynomial fitting or 'RANSAC' for RANSAC-fitting which
      is more robust to outliers

  Returns:
    float:
      expected h for white noise
  """
  rsvals = [expected_rs(n) for n in nvals]
  poly = poly_fit(np.log(nvals), np.log(rsvals), 1, fit=fit)
  return poly[0]