Survival analysis with survminer package in R: change number of decimal places in p-value
0
0
Entering edit mode
2.6 years ago
isd1989 • 0

Hi everyone.

This is my first post on Biostars, so I am not completely sure that this is the best place to ask this question.

I have been using the survminer package in R to do survival analysis (Kaplan-Meier time-to-event) on my data. It is a great package that works very well for me. The only thing that I have not figured out how to do yet is how to change the number of decimal places that the p-value is displayed at. I have looked at the reference manual and cannot find it there either.

I am hoping that someone knows how to do this and could provide some help please.

Thank you!

survminer survival pval R • 2.8k views
ADD COMMENT
0
Entering edit mode

Just in case this helps, the code below shows the function that produces the Kaplan-Meier curve.

plot10 <- ggsurvplot( fit10, xlab = "Months", 
                     ylab ="Disease free survival probability",
                     legend.title= "Treatment group",
                     legend.labs= c("A", "B"),
                     censor= FALSE,
                     break.time.by= 12,
                     conf.int= TRUE,
                     risk.table = TRUE,
                     risk.table.y.text = TRUE,
                     pval = TRUE,
                     pval.method = TRUE,
                     surv.median.line = "hv",
                     axes.offset= FALSE)
ADD REPLY
1
Entering edit mode

I had the same query long back. What I was doing to resolve this issue is, extracting the p-value manually using surv_pvalue() and then adding it on the KM-plot with the pval parameter

#parse p-value 
p.value <- surv_pvalue(fit = fit, data = surv_data)

#plot it on KM-plot
ggsurvplot(fit, data = surv_data, pval = p.value$pval, ggtheme = theme_survminer(), ......) 
# you can control the decimal points using `format()` in R; format(p.value$pval, digits = 2)
ADD REPLY
0
Entering edit mode

Thank you! That's a good workaround and I will give it a go.

Still, I find it a bit strange that there isn't an argument that does this within survminer itself. That would improve reproducibility probably.

Thank you again for taking the time to post your answer above.

ADD REPLY

Login before adding your answer.

Traffic: 3106 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6