I'm attempting to create a forest plot based on hazard ratio for Cox model with ggforest. In my data, "CD4" represents the number of CD4 cells measures, and because this varies, I tried to group them as intervals by using the cut () function to symplify my forest plot. However, while the grouping seemed to work, I got a tons of warning messages upon sourcing the script:
The following objects are masked from aids (pos = 3):
CANNANG, CD4, KETCUC, MABN, NHOM, THOIGIAN
Warning messages:
1: In coxph.fit(X, Y, istrat, offset, init, control, weights = weights, :
Loglik converged before variable 1,2 ; coefficient may be infinite.
2: Transformation introduced infinite values in continuous y-axis
3: Transformation introduced infinite values in continuous y-axis
4: Transformation introduced infinite values in continuous y-axis
5: Transformation introduced infinite values in continuous y-axis
6: Transformation introduced infinite values in continuous y-axis
7: Transformation introduced infinite values in continuous y-axis
8: Transformation introduced infinite values in continuous y-axis
9: Transformation introduced infinite values in continuous y-axis
10: Position guide is perpendicular to the intended axis. Did you mean to specify a different guide `position`?
>
This is how my code goes, other variables such as NHOM (treatment group) and CANNANG (weight) don't trigger any problems:
attach(aids)
aids$CD4 <- cut(aids$CD4,c(15,150,200,350))
aids$CD4 <- as.factor(aids$CD4)
aids$NHOM <- as.factor(aids$NHOM)
aids$CANNANG <- factor(ifelse(aids$CANNANG>=50,">=50","<50"))
coxmod2 <- coxph(Surv(THOIGIAN,KETCUC)~CD4+NHOM+CANNANG,data=aids)
f <- ggforest(coxmod2,data=aids)
As a result of the warning, when I called "f", the plot did not show up at all. Viewing my edited dataset and using the summary function indicated that cut() worked just fine, so I wonder if it's something wrong with my code that rendered ggforest unable to plot intervals.
Any help would be really appreciated. Thank you in advance.