statsmodels.robust.robust_linear_model.RLM.fit

RLM.fit(maxiter=50, tol=1e-08, scale_est='mad', init=None, cov='H1', update_scale=True, conv='dev', start_params=None)[source]

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 – Results instance

Return type:

statsmodels.rlm.RLMresults