I never tried to do it this way. I didn't know it can be made so easily.
We had an unfinished GSOC project 2 years ago that was intended to
implement this.
This is essentially what statsmodels RLM does for the linear model,
only spread out over 3 modules and 4 classes (with choice of loss
function, scale estimator and robust standard errors).
a bit of background
Following up at looking some corner case behavior of the current RLM,
I did another round of background readings on robust methods. I never
went through several details of what's currently implemented.
A few reasons why I wanted to try the version where we just optimize a
loss function
- Tukey Biweight has often local minima (besides those that might be
in the non-linear function), maybe scipy.optimize.basinhopping can
help with the global minimum.
The advantage of HuberT and similar is that they have a unique minimum
(in the linear case).
- we can estimate location and scale at the same time (which is not
always good).
- for me it's easier to think about general versions and extensions
when looking at it just as an optimization problem, instead of a
collection of conditions that have to be solved (estimating
equations), or in terms of the optimization algorithm (IRLS)
(for example Results for GenericLikelihoodModel has sandwich form for
standard errors already built in.)
hopefully to come eventually:
robust M-Estimators or similar with (auto- or spatially) correlated
errors, or heteroscedasticity (unequal variances)
robust estimators for Logit, Poisson, ... GLM?
variations on robust estimators
MM-estimators
tau-estimator
S-estimators
I was mainly trying to understand what the current statsmodels.robust
really does.
What do all the default settings in robust mean?
SAS explicitly states the asymptotic relative efficiency of the
M-estimator settings in the documentation.
Josef