Robust Linear Models#

Robust linear models with support for the M-estimators listed under Norms.

See Module Reference for commands and arguments.

Examples#

# Load modules and data
In [1]: import statsmodels.api as sm

In [2]: data = sm.datasets.stackloss.load()

In [3]: data.exog = sm.add_constant(data.exog)

# Fit model and print summary
In [4]: rlm_model = sm.RLM(data.endog, data.exog, M=sm.robust.norms.HuberT())

In [5]: rlm_results = rlm_model.fit()

In [6]: print(rlm_results.params)
const       -41.026498
AIRFLOW       0.829384
WATERTEMP     0.926066
ACIDCONC     -0.127847
dtype: float64

Detailed examples can be found here:

Technical Documentation#

References#

  • PJ Huber. ‘Robust Statistics’ John Wiley and Sons, Inc., New York. 1981.

  • PJ Huber. 1973, ‘The 1972 Wald Memorial Lectures: Robust Regression: Asymptotics, Conjectures, and Monte Carlo.’ The Annals of Statistics, 1.5, 799-821.

  • R Venables, B Ripley. ‘Modern Applied Statistics in S’ Springer, New York,

  • C Croux, PJ Rousseeuw, ‘Time-efficient algorithms for two highly robust estimators of scale’ Computational statistics. Physica, Heidelberg, 1992.

Module Reference#

Model Classes#

RLM(endog, exog[, M, missing])

Robust Linear Model

Model Results#

RLMResults(model, params, ...[, cov])

Class to contain RLM results

Norms#

AndrewWave([a])

Andrew's wave for M estimation

Hampel([a, b, c])

Hampel function for M-estimation

HuberT([t])

Huber's T for M estimation

LeastSquares()

Least squares rho for M-estimation and its derived functions

MQuantileNorm(q, base_norm)

M-quantiles objective function based on a base norm

RamsayE([a])

Ramsay's Ea for M estimation

RobustNorm()

The parent class for the norms used for robust regression

StudentT([c, df])

Robust norm based on t distribution

TrimmedMean([c])

Trimmed mean function for M-estimation

TukeyBiweight([c])

Tukey's biweight function for M-estimation

TukeyQuartic([c, k])

Variant of Tukey's biweight function with power 4 for M-estimation

estimate_location(a, scale[, norm, axis, ...])

Estimate a robust location parameter using an M-estimator.

Scale#

Huber([c, tol, maxiter, norm])

Huber's proposal 2 for estimating location and scale jointly

HuberScale([d, tol, maxiter])

Huber's scaling for fitting robust linear models

MScale(chi_func, scale_bias)

M-scale estimation

mad(a[, c, axis, center])

The Median Absolute Deviation along given axis of an array

hubers_scale

Huber's scaling for fitting robust linear models

iqr(a[, c, axis])

The normalized interquartile range along given axis of an array

qn_scale(a[, c, axis])

Computes the Qn robust estimator of scale

scale_tau(data[, cm, cs, weight_mean, ...])

Tau estimator of univariate scale

scale_trimmed(data, alpha[, center, axis, ...])

Scale estimate based on symmetrically trimmed sample

Deterministic-Start Robust Covariance Estimation#

Robust estimators of multivariate location and scatter, including the minimum covariance determinant (MCD) and S-estimators with deterministic (non-random) starting values.

CovM(data[, norm_mean, norm_scatter, ...])

M-estimator for multivariate Mean and Scatter

CovDetMCD(data)

Minimum covariance determinant estimator with deterministic starts

CovDetS(data[, norm, breakdown_point])

S-estimator for mean and covariance with deterministic starts

CovDetMM(data[, norm, breakdown_point, ...])

MM estimator using DetS as first stage estimator

Resistant (Deterministic-Start) Regression#

Regression M- and MM-estimators using S-estimator starting values computed deterministically, rather than through random resampling.

RLMDetS(endog, exog[, norm, ...])

S-estimator for linear model with deterministic starts.

RLMDetSMM(endog, exog[, norm, efficiency, ...])

MM-estimator with S-estimator starting values.