Skip to content

Error Using OEM with Categorical Variables #18

@chandrabanerjee

Description

@chandrabanerjee

Hello,
I am trying to use OEM for grouped LASSO on a tall dataset which contains many categorical variables (and as a result, lots of binary variables in the model matrix). While running cv.oem, I keep getting the following error:

Error in oemfit.binomial(is.sparse, x, y, family, penalty, weights, groups, :
TridiagEigen: failed to compute all the eigenvalues

This does not just extend to my use case, but also to smaller datasets like the birthwt data from the MASS package. I am pasting a reproducible example below:

`
library(MASS)
library(splines)
library(oem)

#Load and create Model Matrix
data("birthwt")
view(birthwt)

birthwt$race = as.factor(birthwt$race)
birthwt$smoke = as.factor(birthwt$smoke)
birthwt$low = as.factor(birthwt$low)

X = model.matrix(low~ns(age,3)+ns(lwt,3)+race+smoke+ptl, birthwt)[,-1]
Y = birthwt$low

#Define Groups
grouping = c(1,1,1,2,2,2,3,3,4,5,5,5)

#Run cv.oem for Logistic Regression with Group LASSO penalty:
cvoem = cv.oem(X, Y, family = "binomial", penalty = "grp.lasso", groups = grouping, nfolds = 10)
`

Any help regarding: 1) an explanation of the issue and 2) a workaround would be much appreciated. cv.gglasso is just too slow!

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions