Skip to content

Genentech/BayesERbook

Repository files navigation

This book provides examples of exposure-response analysis with Bayesian methods.

Install necessary packages BayesERtools website

The examples utilizes BayesERtools package.

You can install the package as follows:

install.packages('BayesERtools')
# devtools::install_github("genentech/BayesERtools") # development version

Quick Example

library(BayesERtools)
library(dplyr)
ggplot2::theme_set(ggplot2::theme_bw(base_size = 12))

# Data
data(d_sim_binom_cov)
df_er_ae_hgly2 <- 
  d_sim_binom_cov |> 
  mutate(AUCss_1000 = AUCss / 1000) |> 
  filter(AETYPE == "hgly2")

# Fit a model
ermod <- dev_ermod_bin(
  data = df_er_ae_hgly2,
  var_resp = "AEFLAG",
  var_exposure = "AUCss_1000"
)

# Goodness-of-fit plot
plot_er_gof(ermod, var_group = "Dose_mg", show_coef_exp = TRUE) *
  xgxr::xgx_scale_x_log10(guide = ggplot2::guide_axis(minor.ticks = TRUE))

Model types supported by BayesERtools

Binary endpoint
Continuous endpoint
Linear (logit) Emax (logit) Linear Emax
backend rstanarm rstanemax rstanarm rstanemax
reference 🔗 🔗 🔗 🔗
develop model
simulate & plot ER
exposure metrics selection
covariate selection
covariate forest plot 🟡
✅ Available, 🟡 In plan/under development, ❌ Not in a current plan

Note for developer

Run usethis::use_tidy_style(strict = FALSE) before committing to ensure that the code is formatted appropriately.

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •