install.packages("remotes")
remotes::install_github("maomlab/BayesPharma")
Introduction
The BayesPharma
package contains a collection of R tools for analyzing pharmacology data using Bayesian statistics and modeling. In comparison to likelihood-based inference, BayesPharma
builds on the stan
ecosystem and brms
package. BayesPharma
facilitates applying a principled Bayesian workflow to to fit and analyze several foundational pharmacology models, such as dose-response modeling, modeling Pnear and folding funnels from molecular modeling, and modeling potential docking ‘hit-rate’ curves as a function of dock score from ultra-large library docking (Lyu et al. (2019), Alon et al. (2021)).
Installation
Pre-requisites
Follow the instructions to install rstan
Usage
The predictor columns are typically treatment variables like drug
or batch variable like well_id
.
To use the model to, for example fit a sigmoid agonist model:
model <- BayesPharma::sigmoid_model(
data = data,
formula = BayesPharma::sigmoid_agoinst_formula(),
prior = BayesPharma::sigmoid_agonsit_prior(),
init = BayesPharma::sigmoid_agonist_init())
Evaluate model fit
Once the model has been fit, to evaluate it
Basic statistics
model |> posterior::summarize_draws()
Regression plot
model |> BayesPharma::plot_posterior_draws()
Prior densities
model |> BayesPharma::density_distributions()
model |> BayesPharma::posterior_densities()
model |> BayesPharma::prior_posterior_densities()
posterior predictive check
model |> brms::pp_check(type = "dens_overlay", ndraws = 50)