gcFitModel: Function to fit parametric models to growth data.

Description Usage Arguments Details Value See Also Examples

View source: R/gcFitModel.R

Description

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

Usage

1
2
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.

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.

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.

See Also

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

Examples

1
2
3
4
5
x <- 1:30
y <- 1/(1+exp(0.5*(15-x)))+rnorm(30)/20
TestRun <- gcFitModel(x,y)
print(summary(TestRun))
plot(TestRun)

Example output

--> Try to fit model logistic....... OK
--> Try to fit model richards....... OK
--> Try to fit model gompertz....... OK
--> Try to fit model gompertz.exp... OK

   mu.model lambda.model   A.model integral.model stdmu.model stdlambda.model
1 0.1586018     12.53085 0.8194416       15.13217  0.01645947        0.323177
  stdA.model ci90.mu.model.lo ci90.mu.model.up ci90.lambda.model.lo
1 0.05545682         0.131526        0.1856776             11.99923
  ci90.lambda.model.up ci90.A.model.lo ci90.A.model.up ci95.mu.model.lo
1             13.06248       0.7282151       0.9106681        0.1263412
  ci95.mu.model.up ci95.lambda.model.lo ci95.lambda.model.up ci95.A.model.lo
1        0.1908624             11.89743             13.16428       0.7107462
  ci95.A.model.up
1        0.928137

grofit documentation built on May 30, 2017, 4:08 a.m.