code: def linregressIgnoringOutliers(x, y, n_iter=3, nstd=2):
      
      for _ in range(n_iter):
          m, n = linregress(x, y)[:2]
          y_fit = x * m + n
          dy = y - y_fit
          std = (dy**2).mean()**0.5
          inliers = abs(dy) < nstd * std
          if inliers.sum() > 2:
              x = x[inliers]
              y = y[inliers]
          else:
              break
      return linregress(x, y)
docs: do linear regression [n_iter] times
      successive removing [outliers]
      return result of normal linregress