docstr: Fits the model using iteratively reweighted least squares.
  
  The IRLS routine runs until the specified objective converges to `tol`
  or `maxiter` has been reached.
  
  Parameters
  ----------
  conv : str
      Indicates the convergence criteria.
      Available options are "coefs" (the coefficients), "weights" (the
      weights in the iteration), "sresid" (the standardized residuals),
      and "dev" (the un-normalized log-likelihood for the M
      estimator).  The default is "dev".
  cov : str, optional
      'H1', 'H2', or 'H3'
      Indicates how the covariance matrix is estimated.  Default is 'H1'.
      See rlm.RLMResults for more information.
  init : str
      Specifies method for the initial estimates of the parameters.
      Default is None, which means that the least squares estimate
      is used.  Currently it is the only available choice.
  maxiter : int
      The maximum number of iterations to try. Default is 50.
  scale_est : str or HuberScale()
      'mad' or HuberScale()
      Indicates the estimate to use for scaling the weights in the IRLS.
      The default is 'mad' (median absolute deviation.  Other options are
      'HuberScale' for Huber's proposal 2. Huber's proposal 2 has
      optional keyword arguments d, tol, and maxiter for specifying the
      tuning constant, the convergence tolerance, and the maximum number
      of iterations. See statsmodels.robust.scale for more information.
  tol : float
      The convergence tolerance of the estimate.  Default is 1e-8.
  update_scale : Bool
      If `update_scale` is False then the scale estimate for the
      weights is held constant over the iteration.  Otherwise, it
      is updated for each fit in the iteration.  Default is True.
  start_params : array_like, optional
      Initial guess of the solution of the optimizer. If not provided,
      the initial parameters are computed using OLS.
  
  Returns
  -------
  results : statsmodels.rlm.RLMresults
      Results instance
code: def fit(
      self,
      maxiter=50,
      tol=1e-8,
      scale_est="mad",
      init=None,
      cov="H1",
      update_scale=True,
      conv="dev",
      start_params=None,
  ):
      """
      Fits the model using iteratively reweighted least squares.
  
      The IRLS routine runs until the specified objective converges to `tol`
      or `maxiter` has been reached.
  
      Parameters
      ----------
      conv : str
          Indicates the convergence criteria.
          Available options are "coefs" (the coefficients), "weights" (the
          weights in the iteration), "sresid" (the standardized residuals),
          and "dev" (the un-normalized log-likelihood for the M
          estimator).  The default is "dev".
      cov : str, optional
          'H1', 'H2', or 'H3'
          Indicates how the covariance matrix is estimated.  Default is 'H1'.
          See rlm.RLMResults for more information.
      init : str
          Specifies method for the initial estimates of the parameters.
          Default is None, which means that the least squares estimate
          is used.  Currently it is the only available choice.
      maxiter : int
          The maximum number of iterations to try. Default is 50.
      scale_est : str or HuberScale()
          'mad' or HuberScale()
          Indicates the estimate to use for scaling the weights in the IRLS.
          The default is 'mad' (median absolute deviation.  Other options are
          'HuberScale' for Huber's proposal 2. Huber's proposal 2 has
          optional keyword arguments d, tol, and maxiter for specifying the
          tuning constant, the convergence tolerance, and the maximum number
          of iterations. See statsmodels.robust.scale for more information.
      tol : float
          The convergence tolerance of the estimate.  Default is 1e-8.
      update_scale : Bool
          If `update_scale` is False then the scale estimate for the
          weights is held constant over the iteration.  Otherwise, it
          is updated for each fit in the iteration.  Default is True.
      start_params : array_like, optional
          Initial guess of the solution of the optimizer. If not provided,
          the initial parameters are computed using OLS.
  
      Returns
      -------
      results : statsmodels.rlm.RLMresults
          Results instance
      """
      if cov.upper() not in ["H1", "H2", "H3"]:
          raise ValueError("Covariance matrix %s not understood" % cov)
      else:
          self.cov = cov.upper()
      conv = conv.lower()
      if conv not in ["weights", "coefs", "dev", "sresid"]:
          raise ValueError(
              "Convergence argument %s not understood" % conv
          )
      self.scale_est = scale_est
  
      if start_params is None:
          wls_results = lm.WLS(self.endog, self.exog).fit()
      else:
          start_params = np.asarray(
              start_params, dtype=np.double
          ).squeeze()
          if (
              start_params.shape[0] != self.exog.shape[1]
              or start_params.ndim != 1
          ):
              raise ValueError(
                  "start_params must by a 1-d array with {} "
                  "values".format(self.exog.shape[1])
              )
          fake_wls = reg_tools._MinimalWLS(
              self.endog,
              self.exog,
              weights=np.ones_like(self.endog),
              check_weights=False,
          )
          wls_results = fake_wls.results(start_params)
  
      if not init:
          self.scale = self._estimate_scale(wls_results.resid)
  
      history = dict(params=[np.inf], scale=[])
      if conv == "coefs":
          criterion = history["params"]
      elif conv == "dev":
          history.update(dict(deviance=[np.inf]))
          criterion = history["deviance"]
      elif conv == "sresid":
          history.update(dict(sresid=[np.inf]))
          criterion = history["sresid"]
      elif conv == "weights":
          history.update(dict(weights=[np.inf]))
          criterion = history["weights"]
  
      # done one iteration so update
      history = self._update_history(wls_results, history, conv)
      iteration = 1
      converged = 0
      while not converged:
          if self.scale == 0.0:
              import warnings
  
              warnings.warn(
                  "Estimated scale is 0.0 indicating that the most"
                  " last iteration produced a perfect fit of the "
                  "weighted data.",
                  ConvergenceWarning,
              )
              break
          self.weights = self.M.weights(wls_results.resid / self.scale)
          wls_results = reg_tools._MinimalWLS(
              self.endog,
              self.exog,
              weights=self.weights,
              check_weights=True,
          ).fit()
          if update_scale is True:
              self.scale = self._estimate_scale(wls_results.resid)
          history = self._update_history(wls_results, history, conv)
          iteration += 1
          converged = _check_convergence(
              criterion, iteration, tol, maxiter
          )
      results = RLMResults(
          self,
          wls_results.params,
          self.normalized_cov_params,
          self.scale,
      )
  
      history["iteration"] = iteration
      results.fit_history = history
      results.fit_options = dict(
          cov=cov.upper(),
          scale_est=scale_est,
          norm=self.M.__class__.__name__,
          conv=conv,
      )
      # norm is not changed in fit, no old state
  
      # doing the next causes exception
      # self.cov = self.scale_est = None #reset for additional fits
      # iteration and history could contain wrong state with repeated fit
      return RLMResultsWrapper(results)
  
imports: import numpy
  import scipy.stats
  import statsmodels.base.model
  import statsmodels.base.wrapper
  import statsmodels.regression._tools
  import statsmodels.regression.linear_model
  import statsmodels.robust.norms
  import statsmodels.robust.scale
  from statsmodels.tools.decorators import cache_readonly
  from statsmodels.tools.sm_exceptions import ConvergenceWarning
label_desc: Use image node_id 10 for calling the RLM obj's underlying member method code with example usage: obj.fit(maxiter, tol, scale_est, init, cov, update_scale, conv, start_params) and returns: RLMResultsWrapper