Fit a Bayesian Sigmoid Model
sigmoid_model.RdFits 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, thelog10of 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
=> Infbottom: the response when
=> -Inf
To configure the model you can use the following helper functions for agonist models
sigmoid_agonist_formula(): define how theresponserelates to thetreatmentand 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 theresponserelates to thetreatmentand 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.frameof 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
bpformulaformula for the sigmoid model (see above).- prior
brmspriordefining a distribution for the model parameters defined in the formula. (see above).- init
functionto initialize brms::brm model for for the parameters (see above)- iter
numericof iterations the model runs. Increasingitercan help with model convergence (see brms::brm)- control
a named
listof arguments to control the sampler's behavior. Addingmax_treedepthand giving a greater value than10can 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())
} # }