fit_modls.Rd
A convenient function to fit data using available models and to sort the outcomes by AIC values.
fit_modls(Conc, Resp, Mask = NULL, modls = c("hill", "cnst"), ...)
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. |
A list of components named by the models. The models are sorted by their AIC values. Thus, the first component has the best fit.
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
Fit output from constant model
modl: model type, i.e., cnst
fit: fittable?, 1 or 0
aic: AIC value
er: scale term
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).
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")#> $hill #> $hill$modl #> [1] "hill" #> #> $hill$fit #> [1] 1 #> #> $hill$aic #> [1] 43.68416 #> #> $hill$tp #> [1] 58.6745 #> #> $hill$ga #> [1] -6.622593 #> #> $hill$gw #> [1] 0.6046092 #> #> $hill$er #> [1] 1.36399 #> #># run hill only + increasing direction only fit_modls(concd, respd, modls = "hill", hill_pdir = 1)#> $hill #> $hill$modl #> [1] "hill" #> #> $hill$fit #> [1] 1 #> #> $hill$aic #> [1] 43.68416 #> #> $hill$tp #> [1] 58.6745 #> #> $hill$ga #> [1] -6.622593 #> #> $hill$gw #> [1] 0.6046092 #> #> $hill$er #> [1] 1.36399 #> #># run with mask at the highest concentration fit_modls(concd, respd, maskd)#> $hill #> $hill$modl #> [1] "hill" #> #> $hill$fit #> [1] 1 #> #> $hill$aic #> [1] 32.97162 #> #> $hill$tp #> [1] 49.39584 #> #> $hill$ga #> [1] -7.123603 #> #> $hill$gw #> [1] 1.501527 #> #> $hill$er #> [1] 0.2031836 #> #> #> $cnst #> $cnst$modl #> [1] "cnst" #> #> $cnst$fit #> [1] 1 #> #> $cnst$er #> [1] 3.336611 #> #> $cnst$aic #> [1] 51.39047 #> #>