Skip to contents

Fits the sigmoid model. The functional form is

<response> ~ sigmoid(ac50, hill, top, bottom, <treatment>)

where

sigmoid = bottom + (top - bottom)/(1 + 10^((ac50 - <treatment>) * hill))

By default the observed data (and therefore should be columns in the input data data.frame) are

  • treatment: log_dose, the log10 of the dose as a molar concentration

  • response: response, with unspecified units

and the modeled parameters are

  • ac50: the dose where the response reaches half maximal activity

  • hill: the hill coefficient controlling the slope at the ac50, by convention the slope of an agonist is positive

  • top: the response when => Inf

  • bottom: the response when => -Inf

To configure the model you can use the following helper functions for agonist models

the following helper functions for an antagonist model

Usage

sigmoid_model(
  data,
  formula = sigmoid_agonist_formula(),
  prior = sigmoid_agonist_prior(),
  init = sigmoid_agonist_init(),
  iter = 8000,
  control = list(adapt_delta = 0.99),
  stanvar_function = sigmoid_stanvar(),
  expose_functions = TRUE,
  ...
)

Arguments

data

data.frame of observed data. It must contain columns for the treatment, response and any additional predictors specified in the formula. See sigmoid_agonist_formula() for more details.

formula

bpformula formula for the sigmoid model (see above).

prior

brmsprior defining a distribution for the model parameters defined in the formula. (see above).

init

function to initialize brms::brm model for for the parameters (see above)

iter

numeric of iterations the model runs. Increasing iter can help with model convergence (see brms::brm)

control

a named list of arguments to control the sampler's behavior. Adding max_treedepth and giving a greater value than 10 can improve model convergence (see brms::brm)

stanvar_function

stan code for the model.

expose_functions

logical. Expose the sigmoid function used in the model. This is needed e.g. for brms::loo_compare()

...

additional arguments passed to brms::brm

Value

bpfit object, which is a wrapper around a brms::brmsfit object.

Examples

if (FALSE) {
  BayesPharma::sigmoid_model(
    data = data,
    formula = BayesPharma::sigmoid_antagonist_formula(predictors = 0 + drug),
    prior = BayesPharma::sigmoid_antagonist_prior(),
    init = BayesPharma::sigmoid_antagonist_init())
}