ex <- pcvr::growthSim("logistic",
n = 20, t = 25,
params = list(
"A" = c(200, 160),
"B" = c(13, 11),
"C" = c(3, 3.5)
)
)
m <- mgcv::gam(y ~ group + s(time, by = factor(group)), data = ex)
support <- expand.grid(
time = seq(min(ex$time), max(ex$time), length = 400),
group = factor(unique(ex$group))
)
out <- gam_diff(
model = m, newdata = support, g1 = "a", g2 = "b",
byVar = "group", smoothVar = "time", plot = TRUE
)
dim(out$data)
out$plot
out2 <- gam_diff(
model = m, g1 = "a", g2 = "b", byVar = NULL, smoothVar = NULL, plot = TRUE
)
Run the code above in your browser using DataLab