Robust Linear Models
Estimate a robust linear model via iteratively reweighted least squares given a robust criterion estimator.
Parameters: | endog : array-like
exog : array-like
M : statsmodels.robust.norms.RobustNorm, optional
missing : str
|
---|
Notes
Attributes
Examples
>>> import statsmodels.api 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. |
from_formula(formula, data[, subset, drop_cols]) | Create a Model from a formula and dataframe. |
hessian(params) | The Hessian matrix of the model |
information(params) | |
initialize() | Initialize (possibly re-initialize) a Model instance. |
loglike(params) | |
predict(params[, exog]) | Return linear predicted values from a design matrix. |
score(params) |
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. |
from_formula(formula, data[, subset, drop_cols]) | Create a Model from a formula and dataframe. |
hessian(params) | The Hessian matrix of the model |
information(params) | |
initialize() | Initialize (possibly re-initialize) a Model instance. |
loglike(params) | |
predict(params[, exog]) | Return linear predicted values from a design matrix. |
score(params) |
Attributes
endog_names | Names of endogenous variables |
exog_names | Names of exogenous variables |