1

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.

Phil
  • 7,287
  • 3
  • 36
  • 66
Jesse C
  • 11
  • 1

1 Answers1

0

I am not sure what the problem is, but I would like to point out that if you use method="average", you are not actually adjusting for anything (i am not sure why this method even exists, but my questions fell on deaf ears when contacting the maintainer of survminer).

Maybe you could try using method="conditional" (which is the only method in the ggadjustedcurves function that actually estimates what you usually want to estimate, or you could try the adjustedCurves package instead (https://cran.r-project.org/web/packages/adjustedCurves/index.html).

Denzo
  • 240
  • 1
  • 7