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

Function to obtain the posterior probability of hypotheses about the hazard ratio or survival differences #2

Open
wenjie2wang opened this issue Mar 10, 2021 · 0 comments

Comments

@wenjie2wang
Copy link
Owner

Feature request from Alberto Carmona Bayonas:

Hello, good evening Wenjie. I have a question. I see that you have introduced a new function in dynsurv for quick access to the mcmc draws of the coefficients. However, it would be nice to have the same function for survival differences. Currently you can use survDiff but you cannot calculate specific hypotheses. The mcmc's are accessible through the survDiff code, but it is a long, complex piece of code, and impossible to understand except for programmers. Therefore, it is difficult to transmit to a journal reviewer, if requested. Wouldn't you think it would be a good idea to simplify that part by generating a simple way to test hypotheses about survival differences over time?

If you are going to improve the package I think you could create a new function to obtain the posterior probability of hypotheses about the hazard ratio or survival differences. It would be similar to the hypothesis function in the brms package.

library(tidybayes)
mcmc<-mcmc_list$coef
mcmc<- as.tibble(mcmc)

hypothesis <- function (time,value) ecdf(mcmc[mcmc$time==time,]$coef)(log(value))

For example:

hypothesis (time=7,value=0.85) # this would be the probability after 7 months, the hazard ratio is less than 0.85.

This could also be done for the difference in survival. In addition, a plot could be added to represent this posterior probability at various time points, and as a function of various values or priors...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant