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

ggcompetingrisks following multistate Cox PH #625

Open
adamssv opened this issue Apr 25, 2023 · 0 comments
Open

ggcompetingrisks following multistate Cox PH #625

adamssv opened this issue Apr 25, 2023 · 0 comments

Comments

@adamssv
Copy link

adamssv commented Apr 25, 2023

Expected behavior

Should it be possible to fit a multi-state Cox PH model, then generate a ggcompetingrisks() plot given data to fix model covariates...?

Actual behavior

error:
!Names repair functions can't return 'NA' values

Steps to reproduce the problem

Follow example from Thernau et al, with survival package.
(edit, citation: https://cran.r-project.org/web/packages/survival/vignettes/compete.pdf)

library(survival)
mgus2 <- mgus2
cfit1 <- coxph(Surv(etime, event) ~ age + sex + mspike, mgus2, id=id)
print(cfit1, digits=2)

dummy <- expand.grid(sex=c("F","M"), age=60, mspike=1.2)
dummy
csurv <- survfit(cfit1, newdata=dummy)

#this plot works showing probability of death or PCM, the two outcomes
plot(csurv, xmax=25*12, xscale=12, xlab="Years", ylab="Pr(Outcome)", col=1:2, lty=c(1,1,2,2), lwd=2)
legend(10, .14 , outer(c("female", "male "), c("pcm","death"), paste, sep=", ") ,
       col=1:2, lty=c(1,1,2,2), bty='n', lwd=2 )

#should this be able to make a similar plot with ggcompetingrisks() -style "stacked" plot instead of the lines?
ggcompetingrisks(csurv)
# returns error about names being NA

session_info()

# please paste here the result of
devtools::session_info()

survminer v 0.4.9
survival v 3.5-0
R 4.1.2

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

No branches or pull requests

1 participant