# The six-curve illustration from Kelley (2005): alpha = 0.75 and
# zeta = 0.25 throughout, so every curve crosses its inflection at
# the same height, 0.75 / exp(1) + 0.25, about 0.526. The three
# rising curves share the inflection time beta = 2 and differ only
# in curvature; the three falling curves share beta = 3. Each curve
# is its own population of size one, so a single call draws the whole panel.
panel <- simulate_longitudinal_gompertz(
n = 1, target_times = seq(0, 6, by = 0.1),
fixed_parameters = list(
c(alpha = 0.75, beta = 2, gamma = 1.75, zeta = 0.25),
c(alpha = 0.75, beta = 2, gamma = 1.00, zeta = 0.25),
c(alpha = 0.75, beta = 2, gamma = 0.45, zeta = 0.25),
c(alpha = 0.75, beta = 3, gamma = -0.35, zeta = 0.25),
c(alpha = 0.75, beta = 3, gamma = -0.60, zeta = 0.25),
c(alpha = 0.75, beta = 3, gamma = -2.00, zeta = 0.25)),
error_variance = 0
)
plot_trajectories(panel, id = "id", time = "time",
outcome = "true_score", group = "population")
# Individual differences in a single parameter: only the inflection
# time varies (a named entry leaves every other variance at zero),
# so every trajectory shares the floor and the ceiling but reaches
# its fastest growth at its own moment.
set.seed(113)
d_beta <- simulate_longitudinal_gompertz(
n = 25, target_times = seq(0, 8, by = 0.5),
fixed_parameters = c(alpha = 75, beta = 3, gamma = 0.55, zeta = 10),
random_variances = c(beta = 0.8), error_variance = 0
)
plot_trajectories(d_beta, id = "id", time = "time",
outcome = "true_score")
# Individual differences in every parameter at once, plus level-one
# error: the realistic sampling model.
set.seed(113)
d <- simulate_longitudinal_gompertz(
n = 30, target_times = 0:12,
fixed_parameters = c(alpha = 75, beta = 3, gamma = 0.55, zeta = 10),
random_variances = c(alpha = 36, beta = 0.8, gamma = 0.01, zeta = 9),
error_variance = 16
)
plot_trajectories(d, id = "id", time = "time", outcome = "y")
Run the code above in your browser using DataLab