Learn R Programming

grofit (version 1.1.1-1)

gcFitModel: Function to fit parametric models to growth data.

Description

Performs a parametric fit of certain models. The model with the best AIC is returned.

Usage

gcFitModel(time, data, gcID = "undefined", control = grofit.control())

Arguments

time
Numeric vector containing the data for x-axes.
data
Numeric vector giving the growth values belonging to each element of time.
gcID
Vector (of any length) identifying the growth curve data.
control
Object of class grofit.control containing a list of options generated by the function grofit.control.

Value

Generates an object of class gcFitModel
raw.time
Raw data given to the function; equivalent to time.
raw.data
Raw data given to the function; equivalent to data.
gcID
Identifier, given to the function as gcID.
fit.time
Vector of fitted concentration values.
fit.data
Vector of fitted growth values.
parameters
List of estimated growth values.
A
Maximum growth value.
mu
Maximum slope.
lambda
Lag-phase.
integral
Integral under growth curve.
model
String naming the parametric model used.
nls
nls object generated by the R internal function nls.
reliable
Logical, indicating wether the provided data is reliable (to be set manually).
fitFlag
Logical, indicating wether a model could fitted successfully to data.
control
Object of class grofit.control containing list of options passed to the function as control.

Details

The function calls gcFitSpline that uses the R internal function lowess to estimate initial values for the parametric fit. Four different models were tested by default. By means of an AIC criterion it is decided which model fits the data best. The tested models are: Gompertz law, modified Gompertz law, logistic law and Richards law.

Note: If a certain model depicts not an appropriate description of a given data set nls might stop and produce an error. This error stems from the generation of infinite or missing values or singular gradients in the optimization algorithm. These errors are not to be taken critical and indicates only that a certain model is not an appropriate description of a certain growth curve. When trying a couple of models it is usual that some of them can not be fitted. To prevent an overflow of almost redundant error messages ("nls(formulamodel, start = init.model) : singular gradient", "Error in numericDeriv(form[[3L]], names(ind), env) : missing value or an inifinite produced by the model") they are displayed only as short error message on screen. If errors were frequently produced in models the user expects to be suitable, a change of the inital value definition (see e.g. initgompertz, initlogistic) might help.

See Also

gompertz, gompertz.exp, richards, logistic, gcFitSpline, summary.gcFitModel, plot.gcFitModel

Examples

Run this code
x <- 1:30
y <- 1/(1+exp(0.5*(15-x)))+rnorm(30)/20
TestRun <- gcFitModel(x,y)
print(summary(TestRun))
plot(TestRun)

Run the code above in your browser using DataLab