You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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)
session_info()
survminer v 0.4.9
survival v 3.5-0
R 4.1.2
The text was updated successfully, but these errors were encountered: