Description Usage Arguments Value See Also Examples
View source: R/all_growthmodels.R
Determine maximum growth rates by nonlinear fits for a series of experiments.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34  all_growthmodels(...)
## S3 method for class 'formula'
all_growthmodels(
formula,
data,
p,
lower = Inf,
upper = Inf,
which = names(p),
FUN = NULL,
method = "Marq",
transform = c("none", "log"),
...,
subset = NULL,
ncores = detectCores(logical = FALSE)
)
## S3 method for class ''function''
all_growthmodels(
FUN,
p,
data,
grouping = NULL,
time = "time",
y = "value",
lower = Inf,
upper = Inf,
which = names(p),
method = "Marq",
transform = c("none", "log"),
...,
ncores = detectCores(logical = FALSE)
)

... 
generic parameters, including parameters passed to the optimizer. 
formula 
model formula specifying dependent, independent and grouping
variables in the form:

data 
data frame of observational data. 
p 
named vector of start parameters and initial values of the growth model. 
lower 
lower bound of the parameter vector. 
upper 
upper bound of the parameter vector. 
which 
vector of parameter names that are to be fitted. 
FUN 
function of growth model to be fitted. 
method 
character vector specifying the optimization algorithm. 
transform 
fit model to nontransformed or logtransformed data. 
subset 
a specification of the rows to be used: defaults to all rows. 
ncores 
number of CPU cores used for parallel computation. The number
of real cores is detected automatically by default,
but fort debugging purposes it could be wise to set 
grouping 
vector of grouping variables defining subsets in the data frame. 
time 
character vector with name of independent variable. 
y 
character vector with name of dependent variable. 
object containing the parameters of all fits.
Other fitting functions:
all_easylinear()
,
all_splines()
,
fit_easylinear()
,
fit_growthmodel()
,
fit_spline()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49  data(bactgrowth)
splitted.data < multisplit(value ~ time  strain + conc + replicate,
data = bactgrowth)
## show which experiments are in splitted.data
names(splitted.data)
## get table from single experiment
dat < splitted.data[["D:0:1"]]
fit0 < fit_spline(dat$time, dat$value)
fit1 < all_splines(value ~ time  strain + conc + replicate,
data = bactgrowth, spar = 0.5)
## these examples require some CPU power and may take a bit longer
## initial parameters
p < c(coef(fit0), K = max(dat$value))
## avoid negative parameters
lower = c(y0 = 0, mumax = 0, K = 0)
## fit all models
fit2 < all_growthmodels(value ~ time  strain + conc + replicate,
data = bactgrowth, FUN=grow_logistic,
p = p, lower = lower, ncores = 2)
results1 < results(fit1)
results2 < results(fit2)
plot(results1$mumax, results2$mumax, xlab="smooth splines", ylab="logistic")
## experimental: nonlinear model as part of the formula
fit3 < all_growthmodels(
value ~ grow_logistic(time, parms)  strain + conc + replicate,
data = bactgrowth, p = p, lower = lower, ncores = 2)
## this allows also to fit to the 'global' data set or any subsets
fit4 < all_growthmodels(
value ~ grow_logistic(time, parms),
data = bactgrowth, p = p, lower = lower, ncores = 1)
plot(fit4)
fit5 < all_growthmodels(
value ~ grow_logistic(time, parms)  strain + conc,
data = bactgrowth, p = p, lower = lower, ncores = 2)
plot(fit5)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.