Fit a Bayesian Sigmoid Model
sigmoid_model.Rd
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
, thelog10
of the dose as a molar concentrationresponse:
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 positivetop: the response when
=> Inf
bottom: the response when
=> -Inf
To configure the model you can use the following helper functions for agonist models
sigmoid_agonist_formula()
: define how theresponse
relates to thetreatment
and the parameters withac50
->ec50
, and how any covariates predict the parameterssigmoid_agonist_prior()
: define the prior for the model parameters, with the slope constrained to be positivesigmoid_agonist_init()
: define initial values for the model parameters to match the defaultsigmoid_agonist_prior()
the following helper functions for an antagonist model
sigmoid_antagonist_formula()
: define how theresponse
relates to thetreatment
and the parameters withac50
->ic50
, and how any covariates predict the parameterssigmoid_antagonist_prior()
: define the prior for the model parameters, with the slope being constrained be negativesigmoid_antagonist_init()
: define initial values for the model parameters to match the defaultsigmoid_antagonist_prior()
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. Seesigmoid_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. Increasingiter
can help with model convergence (see brms::brm)- control
a named
list
of arguments to control the sampler's behavior. Addingmax_treedepth
and giving a greater value than10
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. forbrms::loo_compare()
- ...
additional arguments passed to brms::brm
Value
bpfit
object, which is a wrapper around a brms::brmsfit object.
Examples
if (FALSE) { # \dontrun{
BayesPharma::sigmoid_model(
data = data,
formula = BayesPharma::sigmoid_antagonist_formula(predictors = 0 + drug),
prior = BayesPharma::sigmoid_antagonist_prior(),
init = BayesPharma::sigmoid_antagonist_init())
} # }