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, ...)

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. Currently available models are 3-parameter Hill model (hill), constant model (cnst), and Curve Class2 4-parameter Hill model (cc2). Multiple values are only allowed for the hill and cnst combination.

...

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. Another common parameter for cc2 model is cc2_classSD. The default value of cc2_classSD is 5%, which might be too small for noiser endpoints.

Details

The backbone of fit method using hill (3-parameter Hill model) and cnst (constant model) is based on the implementation from tcpl package. But the lower bound of ga is lower by log10(1/100). The cc2 model is the 4-parameter Hill model from Curve Class2.

Value

A list of components named by the models. The models are sorted by their AIC values (when multiple models are used). 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

cc2

Fit output from Curve Class 2 model

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

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

  • aic: NA, it is not calculated for this model. The parameter is kept for compatability.

  • cc2: curve class2, default = 4

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

  • ga: ac50 (log10 scale)

  • gw: Hill coefficient

  • bt: model bottom

  • pvalue: from F-test, for fit quality

  • r2: fitness

  • masks: a string to indicate at which positions of response are masked

  • nmasks: number of masked responses

See Also

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

Examples


concd <- c(-9, -8, -7, -6, -5, -4)
respd <- c(0, 2, 30, 40, 50, 20)
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 cc2 only + change of classSD
fit_modls(concd, respd, modls = "cc2", cc2_classSD = 10)

# run hill + cnst
fit_modls(concd, respd, modls = c("hill", "cnst"))

# run with mask at the highest concentration
fit_modls(concd, respd, maskd, modls = "hill")



moggces/Rcurvep documentation built on Feb. 6, 2024, 3:30 a.m.