tuneFit {mixtox} | R Documentation |
Find Optimal Starting values for Curve Fitting
Description
Curve fitting is dependent on the package minpack.lm.
This generic function first seaches optimal starting values based on
trial and error. The the concentration response data will be fitted using the optimal
starting values. The statistics for goodness of fit
is evaluated by the following statistics: coefficient of
determination (R^2
), adjusted coefficient of determination (R_{adj}^2
),
root mean squared error (RMSE), mean absolute error (MAE), Akaike information criterion (AIC),
bias-corrected Akaike information criterion(AICc), and Bayesian information criterion (BIC).
Thirteen sigmoidal models ("Hill", "Hill_two", "Hill_three", "Hill_four",
"Weibull", "Weibull_three", "Weibull_four", "Logit", "Logit_three", "Logit_four",
"BCW(Box-Cox-Weibull)", "BCL(Box-Cox-Logit)", "GL(Generalized Logit)") and four
J-shaped models ("Brain_Consens", "BCV", "Biphasic", "Hill_five")
are provided to fit the concentration-response data.
Usage
tuneFit(conc, rspn, eq = 'Weibull', effv, rtype = 'quantal', rsq = 0.6, highBar = 5000,
bar = 1000, sav = FALSE)
Arguments
conc |
a numeric vector (matrix) of experimental concentrations |
rspn |
a numeric vector (matrix) of responses corresponding to conc, it should have the same length (or rows and columns for matrix) as conc. |
eq |
models for curve fitting: "Hill", "Hill_two", "Hill_three", "Hill_four", "Weibull", "Weibull_three", "Weibull_four", "Logit", "Logit_three", "Logit_four", "BCW", "BCL", "GL", "Brain_Consens", "BCV", "Biphasic", "Hill_five". |
rtype |
the response type of endpoint: 'continuous' or 'quantal' data. |
effv |
numeric response to calculate effect concentration, scaled respones [0, 1]. |
rsq |
r2 below which would be ignored. |
highBar |
if the number of starting values exceeds highBar, a random sample of starting values will be taken. |
bar |
the number of random samples. |
sav |
TRUE: save output to a default file; FALSE: output will not be saved; a custom file directory: save output to the custom file directory. |
Details
tuneFit provides high frequency trial and error approach to find appropriate starting
values for users. It will deploy those starting values one by one until
finding the right one.
Function tuneFit can also be used to fit the concentration response data for a batch of
chemicals and calculate corresponding effect concentration.
Value
sta |
goodness of fit statistics: ( |
Note
tuneFit will load the file staval.rda which contains hundreds of starting values for each of the sigmoidal and hormetic models. However, those starting values are also limited. Users are encouraged to send their fitted coefficients to us to extent the coverage of staval.
Examples
## example 1
# Fit the non-monotonic concentration-response data
# we'll get a fit with r2 of 0.740
x <- hormesis$OmimCl$x
expr <- hormesis$OmimCl$y
y <- rowMeans(expr)
tuneFit(x, y, eq = 'Biphasic')
## example 2
# Fit the non-monotonic concentration-response data
# use r2 (rsq) of 0.9, we'll get a fit with r2 of 0.989
# calcualte the effect concentration that causes 5% inhibition
x <- hormesis$OmimCl$x
expr <- hormesis$OmimCl$y
y <- rowMeans(expr)
tuneFit(x, y, eq = 'Biphasic', effv = 0.05, rsq = 0.9)
## example 3
# Fit the concentration-response data of heavy metal Ni(2+) on MCF-7 cells.
# Calculate the concentration that causes 5% inhibition on the growth of MCF-7
x <- cytotox$Ni$x
expr <- cytotox$Ni$y
y <- rowMeans(expr)
tuneFit(x, y, eq = 'Logit', effv = 0.05)
## example 4
# Fit the concentration-response data of Paromomycin Sulfate (PAR) on photobacteria.
# Calculate the concentrations that cause 50% inhibition on the growth of photobacteria
x <- antibiotox$PAR$x
expr <- antibiotox$PAR$y
y <- rowMeans(expr)
tuneFit(x, y, eq = 'Logit', effv = 0.5)