data(bactgrowth)
splitted.data <- multisplit(bactgrowth, c("strain", "conc", "replicate"))
## get table from single experiment
dat <- splitted.data[["D:0:1"]]
fit1 <- fit_spline(dat$time, dat$value)
plot(fit1, log="y")
plot(fit1)
## derive start parameters from spline fit
p <- coef(fit1)
## subset of first 10 data
first10 <- dat[1:10, ]
fit2 <- fit_growthmodel(grow_exponential, p=p, time=first10$time, y=first10$value)
## use parameters from spline fit and take K from the data maximum
p <- c(coef(fit1), K = max(dat$value))
fit3 <- fit_growthmodel(grow_logistic, p=p, time=dat$time, y=dat$value, transform="log")
plot(fit1)
lines(fit2, col="green")
lines(fit3, col="red")
Run the code above in your browser using DataLab