library(ggplot2)
simdf <- growthSim("logistic",
n = 20, t = 25,
params = list("A" = c(200, 160), "B" = c(13, 11), "C" = c(3, 3.5))
)
ggplot(simdf, aes(time, y, group = interaction(group, id))) +
geom_line(aes(color = group)) +
labs(title = "Logistic")
simdf <- growthSim("gompertz",
n = 20, t = 25,
params = list("A" = c(200, 160), "B" = c(13, 11), "C" = c(0.2, 0.25))
)
ggplot(simdf, aes(time, y, group = interaction(group, id))) +
geom_line(aes(color = group)) +
labs(title = "Gompertz")
simdf <- growthSim("weibull",
n = 20, t = 25,
params = list("A" = c(100, 100), "B" = c(1, 0.75), "C" = c(2, 3))
)
ggplot(simdf, aes(time, y, group = interaction(group, id))) +
geom_line(aes(color = group)) +
labs(title = "weibull")
simdf <- growthSim("frechet",
n = 20, t = 25,
params = list("A" = c(100, 110), "B" = c(2, 1.5), "C" = c(5, 2))
)
ggplot(simdf, aes(time, y, group = interaction(group, id))) +
geom_line(aes(color = group)) +
labs(title = "frechet")
simdf <- growthSim("gumbel",
n = 20, t = 25,
list("A" = c(120, 140), "B" = c(6, 5), "C" = c(4, 3))
)
ggplot(simdf, aes(time, y, group = interaction(group, id))) +
geom_line(aes(color = group)) +
labs(title = "gumbel")
simdf <- growthSim("double logistic",
n = 20, t = 70,
params = list(
"A" = c(200, 160), "B" = c(13, 11), "C" = c(3, 3.5),
"A2" = c(400, 300), "B2" = c(35, 40), "C2" = c(3.25, 2.75)
)
)
ggplot(simdf, aes(time, y, group = interaction(group, id))) +
geom_line(aes(color = group)) +
labs(title = "Double Logistic")
simdf <- growthSim("double gompertz",
n = 20, t = 100,
params = list(
"A" = c(180, 140), "B" = c(13, 11), "C" = c(0.2, 0.2),
"A2" = c(400, 300), "B2" = c(50, 50), "C2" = c(0.1, 0.1)
)
)
ggplot(simdf, aes(time, y, group = interaction(group, id))) +
geom_line(aes(color = group)) +
labs(title = "Double Gompertz")
simdf <- growthSim("monomolecular",
n = 20, t = 25,
params = list("A" = c(200, 160), "B" = c(0.08, 0.1))
)
ggplot(simdf, aes(time, y, group = interaction(group, id))) +
geom_line(aes(color = group)) +
labs(title = "Monomolecular")
simdf <- growthSim("exponential",
n = 20, t = 25,
params = list("A" = c(15, 20), "B" = c(0.095, 0.095))
)
ggplot(simdf, aes(time, y, group = interaction(group, id))) +
geom_line(aes(color = group)) +
labs(title = "Exponential")
simdf <- growthSim("linear",
n = 20, t = 25,
params = list("A" = c(1.1, 0.95))
)
ggplot(simdf, aes(time, y, group = interaction(group, id))) +
geom_line(aes(color = group)) +
labs(title = "Linear")
simdf <- growthSim("int_linear",
n = 20, t = 25,
params = list("A" = c(1.1, 0.95), I = c(100, 120))
)
ggplot(simdf, aes(time, y, group = interaction(group, id))) +
geom_line(aes(color = group)) +
labs(title = "Linear with Intercept")
simdf <- growthSim("logarithmic",
n = 20, t = 25,
params = list("A" = c(2, 1.7))
)
ggplot(simdf, aes(time, y, group = interaction(group, id))) +
geom_line(aes(color = group)) +
labs(title = "Logarithmic")
simdf <- growthSim("power law",
n = 20, t = 25,
params = list("A" = c(16, 11), "B" = c(0.75, 0.7))
)
ggplot(simdf, aes(time, y, group = interaction(group, id))) +
geom_line(aes(color = group)) +
labs(title = "Power Law")
simdf <- growthSim("bragg",
n = 20, t = 100,
list("A" = c(10, 15), "B" = c(0.01, 0.02), "C" = c(50, 60))
)
ggplot(simdf, aes(time, y, group = interaction(group, id))) +
geom_line(aes(color = group)) +
labs(title = "bragg")
# simulating models from segmented growth models
simdf <- growthSim(
model = "linear + linear", n = 20, t = 25,
params = list("linear1A" = c(16, 11), "linear2A" = c(0.75, 0.7), "changePoint1" = c(11, 14))
)
ggplot(simdf, aes(time, y, group = interaction(group, id))) +
geom_line(aes(color = group)) +
labs(title = "linear + linear")
simdf <- growthSim(
model = "linear + linear decay", n = 20, t = 25,
params = list("linear1A" = c(16, 11), "linear2A" = c(3, 2), "changePoint1" = c(11, 14))
)
ggplot(simdf, aes(time, y, group = interaction(group, id))) +
geom_line(aes(color = group)) +
labs(title = "linear + linear decay")
simdf <- growthSim(
model = "linear + linear + logistic", n = 20, t = 50,
params = list(
"linear1A" = c(16, 11), "linear2A" = c(3, 4), # linear slopes, very intuitive
"changePoint1" = c(11, 14), "changePoint2" = c(10, 12),
# changepoint1 is standard, changepoint2 happens relative to changepoint 1
"logistic3A" = c(200, 210), "logistic3B" = c(20, 25), "logistic3C" = c(3, 3)
)
)
# similar to changepoint2, the asymptote and inflection point are relative to the starting
# point of the logistic growth component. This is different than the model output
# if you were to fit a curve to this model using `growthSS`.
ggplot(simdf, aes(time, y, group = interaction(group, id))) +
geom_line(aes(color = group)) +
labs(title = "linear + linear + logistic")
Run the code above in your browser using DataLab