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)
library(ggplot2)
theme_set(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) *
  coord_transform(x = "log10") *
  scale_x_continuous(
    breaks = xgxr::xgx_breaks_log10,
    minor_breaks = xgxr::xgx_minor_breaks_log10
  )

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.

About

Resources

License

Stars

4 stars

Watchers

3 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors