Add support for `lqs()` in `stat_poly_eq()` and `stat_poly_line()`
Currrently we support lm() and rlm() and any other function that returns an object of class "lm". MASS::lqs() with method lts is a useful alternative that could be also supported rather easily, I think.
Today, I added support for gls() from package 'nlme'.
- [x] Revise
stat_poly_line() - [x] Revise
stat_ploy_eq() - [x] Revise function documentation
- [x] Revise article
- [x] Test with existing unit tests
- [x] Add new unit tests
For resistant regression, any thoughts on how difficult it would be to identify on the plot, eg with a different colour, which observations are assumed to be outliers?
With robust regression with 'MASS::rlm()' weights can be used to colour the residuals. This is also how 'wle' used to do this. 'wle' seems to have been archived for some time in CRAN. The third example in the section "stat_fit_deviations" shows how I achieved this with 'MASS::rlm()'. I have found this way of highlighting useful in teaching. However, currently, this approach does not work with lqs(). There are no weights in the fitted model object.
So they don't report weights, but implicitly the weights are zero or one. Worth easing an issue for mass?
I am not sure. MASS has been stable for so many years... you could try, though. In such a case, I think the way to go would be the approach used in 'robustbase', implementing weights() with a type parameter.
I haven't yet studied 'robustbase::lmrob' in enough detail to know if it can be used in place of both rlm() and lqs(). The defaults seem different, at least.
weights() is not as widely available as coefficients(), residuals(), fitted() and predict(). For example, there is no specialization of weights() for gls().
Interesting, as weights can be both an input and an output of the modelling process, a single name called weights seems unhelpful. posterior_weights is not a great nsme for the second case, as it implies a Bayesian method. Thoughts?
@markbneal robustbase::lmrob() calls them robustness.weights and robustbase::ltsReg() calls them lts.weights. In the development version of 'ggpp' I am using robustness.weights but I am not particularly happy with this choice. What do you think?Would computed.weights be understandable and with no additional implied meaning related to the procedure used?
Did you notice that I also wrote some comments in #71 about robustbase::ltsReg() as a possible replacement for lqs()?