fit_modls: Fit one set of concentration-response data using types of...

View source: R/tcplfit_hillbase.R

fit_modlsR Documentation

Fit one set of concentration-response data using types of models

Description

A convenient function to fit data using available models and to sort the outcomes by AIC values.

Usage

fit_modls(Conc, Resp, Mask = NULL, modls = c("hill", "cnst"), ...)

Arguments

Conc

A vector of log10 concentrations.

Resp

A vector of numeric responses.

Mask

Default = NULL or a vector of 1 or 0. 1 is for masking the respective response.

modls

The model types for the fitting. Multiple values are allowed. Currently Hill model (hill) and constant model (cnst) are implemented. Default = c("hill", "cnst").

...

The named input configurations for replacing the default configurations. The input configuration needs to add model type as the prefix. For example, hill_pdir = -1 will set the Hill fit only to the decreasing direction.

Details

The backbone of fit using hill and cnst is based on the implementation from tcpl package. But the lower bound of ga is lower by log10(1/100).

Value

A list of components named by the models. The models are sorted by their AIC values. Thus, the first component has the best fit.

hill

Fit output from Hill equation

  • modl: model type, i.e., hill

  • fit: fittable, 1 (yes) or 0 (no)

  • aic: AIC value

  • tp: model top, <0 means the fit for decreasing direction is preferred

  • ga: ac50 (log10 scale)

  • gw: Hill coefficient

  • er: scale term for Student's t distribution

cnst

Fit output from constant model

  • modl: model type, i.e., cnst

  • fit: fittable?, 1 or 0

  • aic: AIC value

  • er: scale term

See Also

tcpl::tcplObjHill(), tcpl::tcplObjCnst(), get_hill_fit_config()

Examples


concd <- c(-9, -8, -7, -6, -5, -4)
respd <- c(0, 2, 30, 40, 50, 60)
maskd <- c(0, 0, 0, 0, 0, 1)

# run hill only
fit_modls(concd, respd, modls = "hill")

# run hill only + increasing direction only
fit_modls(concd, respd, modls = "hill", hill_pdir = 1)

# run with mask at the highest concentration
fit_modls(concd, respd, maskd)



Rcurvep documentation built on Aug. 25, 2022, 5:09 p.m.