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

adds chapter on emax covariate modelling #5

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

djnavarro
Copy link

@djnavarro djnavarro commented Feb 28, 2025

Main changes in this PR:

  • There is a new chapter 10 illustrating emax model development with brms
  • The data generation chapter (now chapter 11) has two new data sets

The emax modeling chapter covers:

  • Core syntax: brmsformula(), brmsfamily(), prior(), and brm()
  • Examples with continuous-response emax data and binary-response emax data
  • Building models with and without covariates
  • Examples of visualizing model predictions
  • Model comparison with LOO-CV

Closes #1

@djnavarro
Copy link
Author

Hi @yoshidk6,

This is a first draft for a brms/emax modelling chapter. It's still a little rough around the edges, but the core concepts are there. I think it is at the point where review would be useful, and have some thoughts/questions about what might be needed at this stage:

  • The current draft only considers regular emax models with gamma=1. Elsewhere in the book there are examples that use the full sigmoidal emax model, and it may be worth illustrating that in this context also
  • Covariate modeling examples only show the case when covariates are placed on the baseline response, and it may be worth showing examples where covariates are placed on other parameters in the emax structural model
  • The chapter doesn't go into much detail on how to use tidybayes/posterior tools with brms models. Some of that is implied in the data visualisation, but not much. I'm not sure if this is really needed though
  • The data visualisations don't show credible intervals or prediction intervals, only the mean predictions. This seems like a big omission, but I'm not sure how much detail we want to include here?
  • Model diagnostics are almost entirely omitted, except insofar as the default output prints some of this information; and the model comparison section is very minimal. More detail may be needed here?

Best, Danielle

@yoshidk6
Copy link
Collaborator

yoshidk6 commented Mar 3, 2025

Hi Danielle, I really appreciate your efforts, this is already looking great!!
Please see my comments below. They are ordered in a roughly the order of priority in my gut feel

  • I think it makes sense to split the current document into two, one showcasing brms based workflow (similar to https://genentech.github.io/BayesERbook/notebook/binary/workflow_wo_package.html) and the other one showcasing covariate modeling.

  • Covariate modeling examples only show the case when covariates are placed on the baseline response, and it may be worth showing examples where covariates are placed on other parameters in the emax structural model

    • Fully agree, effect on Emax or EC50 would be nice
  • For priors on binary Emax model, suggest to use normal(0, 1.5) for E0 and Emax (based on Statistical Rethinking https://discourse.mc-stan.org/t/default-priors-for-logistic-regression-coefficients-in-brms/13742)

  • In the first page after split, we can probably expand on how to set priors? (not top priority)

  • The chapter doesn't go into much detail on how to use tidybayes/posterior tools with brms models. Some of that is implied in the data visualisation, but not much. I'm not sure if this is really needed though

  • The data visualisations don't show credible intervals or prediction intervals, only the mean predictions. This seems like a big omission, but I'm not sure how much detail we want to include here?

    • How about using median_qi() to get CI? Also, we can expand a little bit on the simulation that we do for visualization and give a pointer to the tidybayes workflow
continuous_base_fit |> 
  epred_draws(newdata = tibble(exposure = seq(0, 50000, 1000))) |> 
  median_qi() %>% 
  ggplot(mapping = aes(exposure, .epred)) + 
  geom_path() + 
  geom_ribbon(aes(ymin = .lower, ymax = .upper), alpha = 0.5) +
  geom_point(data = d_example_emax_3cov, aes(y = response))
  • The current draft only considers regular emax models with gamma=1. Elsewhere in the book there are examples that use the full sigmoidal emax model, and it may be worth illustrating that in this context also

    • Agree it would be nice, just one model fit with estimating gamma would be sufficient?
  • Model diagnostics are almost entirely omitted, except insofar as the default output prints some of this information; and the model comparison section is very minimal. More detail may be needed here?

  - I think what we have is fairly good at least for now

@yoshidk6
Copy link
Collaborator

yoshidk6 commented Mar 3, 2025

Down the road I also want to incorporate data generation into BayesERtools so that the readers don't have to download the csv file.. Submitted separate issues (#6 Genentech/BayesERtools#6)

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.

brms example for Emax models with covariates
2 participants