Skip to content

WIP: ENH:LTS, MTL least trimmed squares and ETS and MM-E - #452

Open
josef-pkt wants to merge 21 commits into
statsmodels:mainfrom
josef-pkt:lts
Open

josef-pkt wants to merge 21 commits into
statsmodels:mainfrom
josef-pkt:lts

Conversation

@josef-pkt

Copy link
Copy Markdown
Member

extensions to robust estimation

least trimmed squares
efficient least trimmed squares
mm-estimation
maximum trimmed likelihood

basic models work and look good in MonteCarlo and some examples from papers

no unit tests yet
incomplete integration with RLM
doesn't work with dummy variables yet: if subsets exog is singular, then it doesn't draw extra starting cases, and it breaks (raises exception) in the Poisson case.
no large sample split for FastLTS yet

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not r = self.est_model.resid?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because I'm working here with res_trimmed : res_trimmed.resid (from self.est_model fit) doesn't contain all observations, only the inliers.

So. I need to calculate the errors for the full dataset given by endog exog, not the one from the "trimmed" dataset endog[iin], exog[iin]

(aside: in the initial estimate with the random starting values iin only contains k_vars + 1 observations, not really all inliers.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I think this is related to the way the first stage is performed: your aircraft example clearly shows that the best solutions at stage 1 do not generalizes well at stage 2. A larger n_keep should not improve the results, otherwise this would mean that the best solution on the whole dataset has a very small link with the best solution at stage 1 and we should therefore question the use of such a two-steps algorithm.
What do you think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at the Hawkins paper again, for there pairwise swapping of observations algorithm they have 16% going to the best and 34% going to the third best solution. Not as bad as I remember, but my impression was the set of converged solutions is larger with the RVD LTS algorithm.

some back of the envelope calculations
"So 18 random starting subsets will give a 95% chance of having one lead to the global optimum" quote for aircraft data. 7 convergence sets cover almost 90 % of the starting values, that's about an 18 % chance of converging to the best. To have a 99 % probability of converging to the best solution, we would need roughly 23 starting values.
So if there is a good chance of getting many reasonably good estimates in the first stage, then it might not include the best case for the second stage if n_keep is too small. Also using additional c-steps in the first stage might not help a lot in this case, it just weeds out the awful cases but not the pretty-good-but-not-best cases.

side remark: besides the Hawkins and other traditional datasets, I would have liked to get a collection of models for generating data and test cases that have been used in different papers. I doubt the same settings will be very good for all test cases.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine. Thanks fir the explanation!

Regarding data generation, I also doubt that a module covering the entire range of possible polluted data could be made. It is yet especially important for LTS since the complex structure of the algorithm makes it sensitive to specific data settings.
I coded a data generation module for the MCD test cases but I doubt it would be useful for LTS.

@VirgileFritsch

Copy link
Copy Markdown
Contributor

I had a look at the LTS object and the associated algorithm. I did not look at the examples or the advanced uses of LTS yet (i.e. efficient lts, inclusion with MM-estimators, MTL, ...).
Impressive amount of work! Welldone!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make optional

@josef-pkt

Copy link
Copy Markdown
Member Author

Thanks Virgile, and thanks for the review

@josef-pkt

Copy link
Copy Markdown
Member Author

rebased version in #8125

@josef-pkt josef-pkt added the superseded Used for PRs with content that is superseded by a newer PR label Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-robust superseded Used for PRs with content that is superseded by a newer PR type-enh

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants