On Thu, 8 May 2008, Kittler, Richard wrote: > Is it possible to use some form of robust regression with the > breakpoints routine so that it is less sensitive to outliers?
Conceptually, it is possible to use the underlying dynamic programming algorithm for other objective functions than the residual sum of squares. However, the implementation of breakpoints() exploits the special structure of OLS to speed up computations. For package "fxregime", I've written a more general (and hence even slower) object-oriented implementation. Because it is still a bit instable it's currently hidden in the namespace and essentially undocumented. It could be used for what you want to do if: - Your robust regression is available in R in a function, fit() say, with a formula interface fm <- fit(formula, data) - Your robust regression has an objective function which is additive in the observations and accessible in an extractor, objfun() say: objfun(fm) For OLS these would be lm() and deviance(): ## OLS-optimized interface bp1 <- breakpoints(Nile ~ 1) ## object-oriented interface nile <- data.frame(Nile = Nile) bp2 <- fxregime:::gbreakpoints(Nile ~ 1, data = nile, fit = lm, objfun = deviance) ## compare results summary(bp1)$breakpoints summary(bp2)$breakpoints So if you've got something sensible as an alternative to lm() and deviance(), you could plug that in. The downsides are: (1) This can be terribly slow. (2) Information criteria are not automatically available for selecting the number of breakpoints. I hope that helps, Z > --Rich > > Richard Kittler > Advanced Micro Devices, Inc. > Sunnyvale, CA > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.