Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Singular fit in crr with unused factor level #76

Closed
erikvona opened this issue Aug 11, 2022 · 1 comment · Fixed by #80
Closed

Singular fit in crr with unused factor level #76

erikvona opened this issue Aug 11, 2022 · 1 comment · Fixed by #80

Comments

@erikvona
Copy link

If I run crr, and one of my covariates has a level that does not occur in the data, I get an error that the system is exactly singular:

library(tidycmprsk)

trial$trt <- factor(trial$trt, levels = paste("Drug", c("A", "B", "C")))

crr_mod <- crr(Surv(ttdeath, death_cr) ~ age + trt, trial)
#> 11 cases omitted due to missing values
#> Error in solve.default(h, z[[2]]): Lapack routine dgesv: system is exactly singular: U[3,3] = 0

Created on 2022-08-11 by the reprex package (v2.0.1)

The expected behavior for me would be to ignore the unused level (e.g. run the covariates through a droplevels), or to generate a descriptive error message by testing for this scenario. I wasted quite some time trying to understand why I was getting a singular system in a nonfictive scenario, after I subsetted the data to exclude some patients.

P.s. Thanks for the excellent package! Makes competing risk analysis quite a lot easier to perform and especially to teach.

@ddsjoberg
Copy link
Collaborator

Thank you for the report! We'll address in the next release 🕺🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants