title: "BayesPharma Homepage" execute: eval: false keep-md: true
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)).
Follow the instructions to install rstan
BayesPharma
In R do
::: {.cell}
```{.r .cell-code} install.packages("remotes") remotes::install_github("maomlab/BayesPharma")
:::
Usage
-----
::: {.cell}
```{.r .cell-code}
library(tidyverse)
library(BayesPharma)
data <- data.frame(
response = ...,
treatment = ...,
<predictor columns>)
:::
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:
::: {.cell}
```{.r .cell-code} 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
#### Traceplot
::: {.cell}
```{.r .cell-code}
model |> BayesPharma::traceplot()
:::
::: {.cell}
```{.r .cell-code} model |> posterior::summarize_draws()
:::
#### Regression plot
::: {.cell}
```{.r .cell-code}
model |> BayesPharma::plot_posterior_draws()
:::
::: {.cell}
```{.r .cell-code} model |> BayesPharma::density_distributions() model |> BayesPharma::posterior_densities() model |> BayesPharma::prior_posterior_densities()
:::
#### posterior predictive check
::: {.cell}
```{.r .cell-code}
model |> brms::pp_check(type = "dens_overlay", ndraws = 50)
:::
::: {.cell}
{.r .cell-code}
model <- model |> brms::add_loo_criterion()
model_fit_comparison <- brms::compare_models(model, model_alt)
:::
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.