library(flexFitR)
library(ggplot2)
data(dt_potato)
mod <- dt_potato |>
modeler(
x = DAP,
y = Canopy,
grp = Plot,
fn = "fn_logistic",
parameters = c(a = 4, t0 = 40, k = 100),
subset = 2
)
plot(mod)
tl <- compute_tangent(mod, x = c(48.35, 65))
print(tl)
plot(mod) +
geom_abline(
data = tl,
mapping = aes(slope = slope, intercept = intercept),
linetype = 2,
color = "blue"
) +
geom_point(
data = tl,
mapping = aes(x = x, y = y),
shape = 8,
color = "blue",
size = 2
)
Run the code above in your browser using DataLab