I am trying to learn the mechanics of the glmmLasso package for lasso estimation with a logistic link function with fixed effects but I cannot get a dummy example to work without error.
library(glmmLasso)
y=rbinom(n = 21,size = 1,prob = .5)
x=rnorm(21)
year=rep(1:3, times=7)
ID=rep(1:7, each=3)
df=as.data.frame(cbind(y,x,ID,year))
library(glmmLasso)
lasso_fe=glmmLasso(y~x+as.factor(ID)+as.factor(year), family=binomial(link = logit), lambda=10, data = df)
The error is from the last command: "Error in n %*% s : requires numeric/complex matrix/vector arguments". I understand the error itself, but I do not understand it in this context since the data.frame itself is all numeric and the glmmLasso package requires factoring the grouping variables for fixed effects. The error also seems to occur for all subsets of variables in the equation (even removing the factor variables) and upon removing or changing the other options.