Growth curve fitting for culture data


load packages

require(drwateR)
require(tidyverse)
require(growthcurver)

Generate culture data

k_in <- 1e9
n0_in <- 1e6
r_in <- 0.28   # the initial growth rate
gdf <- tibble(julian = 1:60) |>
  dplyr::mutate(cellden = growthcurver::NAtT(k = k_in,
    n0 = n0_in,
    r = r_in,
    t = julian))

How to use

gcm <- dwfun::gcm(gdf, Nval = "cellden", tval = "julian")
# 生长速率
r <- dwfun::get_grate(gcm)
# Nmax
Nmax <- dwfun::get_gNmax(gcm)
# N0
N0 <- dwfun::get_gN0(gcm)

plot

gcm$data |>
  tibble::as_tibble() |>
  ggplot(aes(t, N / 1e6)) +
geom_line(data = dwfun::get_gpdf(gcm)) +
geom_point(size = 3) +
scale_y_continuous(labels = scales::label_number()) +
annotate(geom = "text", x = 40, y = 200,
  label = sprintf("r = %.4f", get_grate(gcm))) +
labs(x = "Culture time (d)", y = "Cell density (million cells/L)") +
dwfun::theme_sci(3, 3)
Ming Su
Ming Su
Associate Professor of Environmental Engneering

My research interest is water quality problems in drinking water bodies, with a focus on harmful algal blooms and associated taste & odor problems.