Last data update: 2014.03.03

R: Fit growth curves
fitCellGrowthR Documentation

Fit growth curves

Description

Fit a cell growth curve

Usage

  fitCellGrowth(x, z, model = "locfit",
    locfit.h = 3 * 60 * 60, locfit.deg = 2,
    relative.height.at.lag = 0.1)

Arguments

x

numeric vector: time points

z

numeric vector: log(OD)

model

which model to fit.

locfit.h

numeric: h parameter (window size) in call to locfit. The default value is set to three hours assuming x given in seconds. You can detect a better bandwidth by calling bandwidthCV

locfit.deg

numeric: deg parameter (polynomials degree) in call to locfit

relative.height.at.lag

Parameter used by guessCellGrowthParams

Details

For the non-parametric "locfit" model, local regression is done by a call to locfit. The returned maximum growth rate values the maximum value of the fitted derivative over the data points. For the parametric models "logistic", "gompertz", "rosso" and "baranyi", the function does a non-least square fit by calling nls. Initial parameters values are generated by guessCellGrowthParams. The returned maximum growth rate values the mu parameter of these models.

Value

Fit as returned by locfit for the "locfit" model and as returned by nls for the "logistic", "gompertz", "rosso" and "baranyi" models. The returned value also has an attribute maxGrowthRate valueing the inferred maximum growth rate as well as an attribute pointOfMaxGrowthRate valuing the datapoint at which the growth rate is maximal. Also, it has an attribute max valuing the inferred maximum among the time points as well as pointOfMax valuing the datapoint of max fitted value. It gets the additional class cellCurveFit assigned.

Author(s)

Julien Gagneur and Moritz Matthey

See Also

nls, locfit, baranyi, gompertz, logistic, rosso, guessCellGrowthParams, fitCellGrowths

Examples

x = 1:1000
          z = gompertz(x, mu=0.01, l=200, z0=1, zmax=5) + rnorm(length(x),sd=0.1)
          f = fitCellGrowth(x, z, model = "gompertz")
          floc = fitCellGrowth(x, z, model = "locfit", locfit.h=500)
          	plot(x,z, main="simulated data\nGompertz model")
          	lines(x, predict(f,x), lwd=2, col="red")
          	lines(x, predict(floc,x), lwd=2, col="blue")
          	legend( "right", legend=c("gompertz fit", "locfit"), lwd=1, col=c("red","blue") )

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(cellGrowth)
Loading required package: locfit
locfit 1.5-9.1 	 2013-03-22
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/cellGrowth/fitCellGrowth.Rd_%03d_medium.png", width=480, height=480)
> ### Name: fitCellGrowth
> ### Title: Fit growth curves
> ### Aliases: fitCellGrowth
> 
> ### ** Examples
> 
> x = 1:1000
>           z = gompertz(x, mu=0.01, l=200, z0=1, zmax=5) + rnorm(length(x),sd=0.1)
>           f = fitCellGrowth(x, z, model = "gompertz")
>           floc = fitCellGrowth(x, z, model = "locfit", locfit.h=500)
>           	plot(x,z, main="simulated data\nGompertz model")
>           	lines(x, predict(f,x), lwd=2, col="red")
>           	lines(x, predict(floc,x), lwd=2, col="blue")
>           	legend( "right", legend=c("gompertz fit", "locfit"), lwd=1, col=c("red","blue") )
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>