tcplfit2_core: Concentration-response curve fitting

View source: R/tcplfit2_core.R

tcplfit2_coreR Documentation

Concentration-response curve fitting

Description

Concentration response curve fitting using the methods from BMDExpress

Usage

tcplfit2_core(
  conc,
  resp,
  cutoff,
  force.fit = FALSE,
  bidirectional = TRUE,
  verbose = FALSE,
  do.plot = FALSE,
  fitmodels = c("cnst", "hill", "gnls", "poly1", "poly2", "pow", "exp2", "exp3", "exp4",
    "exp5"),
  ...
)

Arguments

conc

Vector of concentrations (NOT in log units).

resp

Vector of responses.

cutoff

Desired cutoff. If no absolute responses > cutoff and force.fit = FALSE, will only fit constant model.

force.fit

If force.fit = TRUE, will fit all models regardless of cutoff.

bidirectional

If bidirectional = FALSE, will only give positive fits.

verbose

If verbose = TRUE, will print optimization details and aics.

do.plot

If do.plot = TRUE, will generate a plot comparing model curves.

fitmodels

Vector of model names to try fitting. Missing models still return a skeleton output filled with NAs.

...

Other fitting parameters (deprecated).

Details

All models are equal to 0 at 0 concentration (zero background). To add more models in the future, write a fit____ function, and add the model name to the fitmodels and modelnames vectors.

Value

List of N(models) elements, one for each of the models run (up to 10), followed by a last element "modelnames", which is a vector of model names so other functions can easily cycle through the output. For a full list, see the documentation for the individual fitting method functions. For each model there is a sublist with elements including:

  • success - was the model successfully fit

  • aic - the AIC value

  • cov - success of the the covariance matrix calculation

  • rme - root mean error of the data around the curve

  • modl - vector of model values at the given concentrations

  • tp - the top of the curve fit

  • ga - the AC50 or Hill paramters

  • er - the error term

  • ... other paramters specific to the model (see the documentation for the specific models)

  • tp_sd, ga_sd, p_sd, etc., the values of the standard deviations of the paramters for the models

  • er_sd - standard deviation of the error term

  • pars - the names of the parameters

  • sds - the names of the standard deviations of the paramters

Examples

conc <- c(.03, .1, .3, 1, 3, 10, 30, 100)
resp <- c(0, .1, 0, .2, .6, .9, 1.1, 1)
output <- tcplfit2_core(conc, resp, .8,
  fitmodels = c("cnst", "hill"), verbose = TRUE,
  do.plot = TRUE
)

tcplfit2 documentation built on Oct. 11, 2023, 1:07 a.m.