Open IsadoraBM opened 3 years ago
This information is insufficient for me to understand the issue. You did not even include the code that triggers the error. I suspect you have an expression in the model formula in a context where rms
wants a simple variable. Otherwise please include a minimal working example.
Hi Professor,
I am getting the same error with cph. I have the code and error below. Survival status is coded as 0 for no event and 1 for event. I notice that a continuous predictor does not lead to the error.
merged2$BMI<-factor(c("Normal", "Overweight", "Obese")) levels(merged2$BMI) [1] "Normal" "Obese" "Overweight" S <- Surv(merged2$Overall.Survival.Months, merged2$Overall.Survival.Status) f <- cph(S ~ merged2$BMI, x=TRUE, y=TRUE) Error in X[, mmcolnames, drop = FALSE] : subscript out of bounds
These are the versions I am using:
packageVersion("rms") [1] ‘6.2.0’ packageVersion("Hmisc") [1] ‘4.6.0’
Thanks for your help. JC
Is this a tibble vs. base R data frame issue?
A single variable in the model is triggering the error so that if I remove it
lrm
runs fine. Thestr
for the troublesome variable looks fine, it is already a factor (so not modeledas.factor(var)
like in #25). Any ideas for troubleshooting the cause?glm()
runs the full model without issue.