I am trying to use the varsel function in projpred to perform predictive variable selection for my brms model.
I keep getting stuck on an error which refers to level of a categorical variable being missing. I thought perhaps it was not appropriate to use varsel with categorical predictors - but I can’t find any specific mention of that in the documentation (although I note none of the examples use categorical predictors).
I created a small example to show the error I am getting.
Is this a problem with the software or is it incorrect to use this function on a model with categorical predictors?
library(brms) library(projpred) d = data.frame(y = rnorm(100), x = c(rnorm(50), rnorm(50, 1)), group = rep(c("A", "B"), each = 50) ) fit = brm(y ~ x + group, data = d) projpred::varsel(fit)
The error I have is:
Error in eval(predvars, data, env) : object 'groupA' not found
I am using MacOS Catlina 10.15.7 & brms 2.15.9