### Navigation

- index
- modules |
- next |
- previous |
- statsmodels v0.2.0 documentation »
- Robust Linear Models »

# scikits.statsmodels.rlm.RLM

class `scikits.statsmodels.rlm.``RLM`(endog, exog, M=<scikits.statsmodels.robust.norms.HuberT object at 0x03305070>)

  Robust Linear Models

  Estimate a robust linear model via iteratively reweighted least squares given a robust criterion estimator.

  Parameters: | endog : array-like 1d endogenous response variable exog : array-like n x p exogenous design matrix M : scikits.statsmodels.robust.norms.RobustNorm, optional The robust criterion function for downweighting outliers. The current options are LeastSquares, HuberT, RamsayE, AndrewWave, TrimmedMean, Hampel, and TukeyBiweight. The default is HuberT(). See scikits.statsmodels.robust.norms for more information.

  Notes

  Attributes

  df_model : float
    The degrees of freedom of the model. The number of regressors p less one for the intercept. Note that the reported model degrees of freedom does not count the intercept as a regressor, though the model is assumed to have an intercept.
  df_resid : float
    The residual degrees of freedom. The number of observations n less the number of regressors p. Note that here p does include the intercept as using a degree of freedom.
  endog : array
    See above. Note that endog is a reference to the data so that if data is already an array and it is changed, then endog changes as well.
  exog : array
    See above. Note that endog is a reference to the data so that if data is already an array and it is changed, then endog changes as well.
  history : dict
    Contains information about the iterations. Its keys are fittedvalues, deviance, and params.
  M : scikits.statsmodels.robust.norms.RobustNorm
    See above. Robust estimator instance instantiated.
  nobs : float
    The number of observations n
  pinv_wexog : array
    The pseudoinverse of the design / exogenous data array. Note that RLM has no whiten method, so this is just the pseudo inverse of the design.
  normalized_cov_params : array
    The p x p normalized covariance of the design / exogenous data. This is approximately equal to (X.T X)^(-1)

  Examples

      >>> import scikits.statsmodels as sm
      >>> data = sm.datasets.stackloss.Load()
      >>> data.exog = sm.add_constant(data.exog)
      >>> rlm_model = sm.RLM(data.endog, data.exog,                            M=sm.robust.norms.HuberT())

      >>> rlm_results = rlm_model.fit()
      >>> rlm_results.params
      array([  0.82938433,   0.92606597,  -0.12784672, -41.02649835])
      >>> rlm_results.bse
      array([ 0.11100521,  0.30293016,  0.12864961,  9.79189854])
      >>> rlm_results_HC2 = rlm_model.fit(cov="H2")
      >>> rlm_results_HC2.params
      array([  0.82938433,   0.92606597,  -0.12784672, -41.02649835])
      >>> rlm_results_HC2.bse
      array([ 0.11945975,  0.32235497,  0.11796313,  9.08950419])
      >>>
      >>> rlm_hamp_hub = sm.RLM(data.endog, data.exog,                           M=sm.robust.norms.Hampel()).fit(                           sm.robust.scale.HuberScale())

      >>> rlm_hamp_hub.params
      array([  0.73175452,   1.25082038,  -0.14794399, -40.27122257])

  Methods

  `deviance`(tmp_results) | Returns the (unnormalized) log-likelihood from the M estimator.
  `fit`([maxiter, tol, scale_est, init, cov, ...]) | Fits the model using iteratively reweighted least squares.
  `information`(params) |
  `score`(params) |

### Navigation

- index
- modules |
- next |
- previous |
- statsmodels v0.2.0 documentation »
- Robust Linear Models »