I'm building a model ensemble with caretStack (package caretEnsemble). Here is a basic example :

models <- caretList(
    methodList=c("lm","rpart", "glm")
meta_model <- caretStack(models, method="rf")

First, I would like a confirmation that I understand how this function works. Correct me if I am wrong :

  • caretList uses lm,rpart and glm to fit x1 and x2 to y (i.e., y~x1+x2)
  • This gives three predictions : plm, prpart, pglm
  • Then caretStack creates the model ensemble and provides a global prediction with rf such as y~plm+prpart+pglm

Second, I think that, depending of the predictor values, one model or another will work better, thus I would like that caretStack takes into account the x1 and x2 predictors y~plm+prpart+pglm+x1+x2

Thus, is it possible to include predictors (eg x1, x2 in my example) in the caretStack ensemble modeling ? Thanks.

  • $\begingroup$ Could you please elaborate on what you mean by "do this"? $\endgroup$ – whuber Aug 27 '18 at 11:29
  • $\begingroup$ @whuber done, is it clearer like this ? $\endgroup$ – MassCorr Aug 27 '18 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.