I am attempting to plot adjusted survival curves for two groups (DEP+ vs DEP-), with this grouping information in the DEP_CAT variable column of the dataframe (SA.HYP.W). When trying to plot the survival of the DEP_CAT variable from the adjusted model, I receive this error:
Error in if (xi > xj) 1L else -1L : missing value where TRUE/FALSE needed
In addition: Warning message:
In Ops.factor(xi, xj) : ‘>’ not meaningful for factors
My cox proportional hazards model looks like this:
CPH.DEPMOD = coxph(Surv(TIME,STATUS) ~ DEP_CAT + AGE + GENDER + BMI + ALICE, data = SA.HYP.W)
I'm able to derive stats successfully, and then I try to plot the adjusted survival curves with ggadjustedcurves using the following code:
ggadjustedcurves(CPH.DEPMOD, data = SA.HYP.W, method = 'average', variable = 'DEP_CAT')
Seems to be pretty straightforward based on the online documentation, but then I receive the following error:
Error in if (xi > xj) 1L else -1L : missing value where TRUE/FALSE needed
In addition: Warning message:
In Ops.factor(xi, xj) : ‘>’ not meaningful for factors
I was expecting a plot of two different survival curves, one for DEP+ and DEP- based on the adjusted model.