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

Alternative PEM casting to long #303

Closed
wants to merge 19 commits into from
Closed

Alternative PEM casting to long #303

wants to merge 19 commits into from

Conversation

mattsecrest
Copy link
Collaborator

In the end, there may be too many new interdependencies that are not worth keeping. We may want to keep your approach and just put some safeguards around the cutpoints chosen. It is also much slower for dynamic borrowing than it is for no borrowing. Anyways, have a peek and let me know what you think @gravesti.

Similar to yours, shows comparable results:

# Non Bayesian piecewise model
library(eha)
pem_eha <- eha::pchreg(Surv(time, status) ~ trt + cov1 + cov2, data = as.data.frame(psborrow2::example_matrix), cuts = c(0, 10, 20, 30, 40, 100))
summary(pem_eha)
pem_eha$convergence
pem_eha$hazards

# piecewise exponential with no borrowing 
pem_psb2 <- create_analysis_obj(
  data_matrix = psborrow2::example_matrix,
  outcome = outcome_surv_pem(time_var = "time", cens_var = "cnsr", cut_points = seq(10, 40, by = 10),
                                       baseline_prior = prior_normal(0, 1000)),
  borrowing = borrowing_full(ext_flag_col = "ext"),
  covariates = add_covariates(c("cov1", "cov2"), priors = prior_normal(0, 1000)),
  treatment = treatment_details("trt", prior_normal(0, 1000)),
)

samples <- psborrow2::mcmc_sample(pem_psb2, parallel_chains = 4, verbose = TRUE, iter_warmup = 5000)

## results seem to match
samples
log(pem_eha$hazards)
summary(pem_eha)
exp(coef(pem_eha))

Still to do if we go with this approach.

  • Test cases
  • Variable dictionary

@mattsecrest mattsecrest requested a review from gravesti as a code owner October 1, 2024 01:26
@mattsecrest mattsecrest closed this Oct 9, 2024
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

Successfully merging this pull request may close these issues.

1 participant