0

I would like to do feature selection with a mixed effect model in R, but I cannot manage to combine the function rfe of the package caret with the function me of the package nlme.

Here is a example that works but does not use a mixed effect model:

data(iris)
names(iris) <- c("A", "B", "C", "D") # change names for compatibility
library(caret)
library(nlme)

rfeRes <- rfe(x = iris[c("B", "C", "D")], 
              y = iris[["A"]], 
               rfeControl = rfeControl(functions = lmFuncs)
)

And here is an outline of what I would like to do:

rfeRes <- rfe(x = iris[c("B", "C", "D")], 
              y = iris[["A"]], 
               rfeControl = rfeControl(functions = lme)
)

Do you have an idea if something like that is possible and how to do it?

milos.ai
  • 3,882
  • 7
  • 31
  • 33
fstevens
  • 1,287
  • 1
  • 17
  • 28

1 Answers1

0

It wouldn't be impossible but really difficult. You would need to define the right lmd functions (see the documentation page).

If you are fitting a random effects model, you would also need to do custom holdout specifications so that you are holding out whatever the independent experimental unit is. So, if you have multiple records per person you will want to hold all of the data for one or more people out at a time. Again, see the caret webpage for the mechanisms to do so.

topepo
  • 13,534
  • 3
  • 39
  • 52
  • Thanks for your answer, but I am not sure to understand all that is explained on your GitHub page. For instance, what are the lmd functions, the set of fhunctions defined in rfeControl$functions ? – fstevens Feb 28 '15 at 16:19
  • Read the whole thing, specifically the section called "Helper Functions" – topepo Mar 02 '15 at 15:05