Dear all, I wish to use backward selection from the package olsrr. ?ols_step_backward_p This gives me a model of class lm. I wish to then run lmRob from the robust package on the SAME variables ie I want to substitute lm -> lmRob in the function call which created the lm model.
Here is a reprex: ---------------------------------------------------------------- library(olsrr) library(robust) myformula <- lm(mpg~.,data = mtcars) # This is how I do backward selection. chosen.model = ols_step_backward_p(myformula,details=F) # Chosen model chosen.model$model # Not sure if this is the correct thing to do lmRob(chosen.model$model) -------------------------------------------------------------------------- My query is : is the above correct ? Do I need to do some meta programming and substitute lm with lmRob ? I am not sure how I would do that in this context using the ?substitute function perhaps ? Many thanks, Ashim ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.