# A six-curve panel in the style of the growth-curve illustrations
# in Kelley (2005): floor 10 and ceiling 90 throughout, so every
# curve crosses its inflection at the same height (50, half the
# total change). The rising curves share beta = 6 and differ only in
# curvature; the falling curves mirror them. Each curve is its own population
# of size one, so a single call draws the whole panel.
panel <- simulate_longitudinal_logistic(
n = 1, target_times = seq(0, 12, by = 0.1),
fixed_parameters = list(
c(alpha = 80, beta = 6, gamma = 2.0, zeta = 10),
c(alpha = 80, beta = 6, gamma = 0.9, zeta = 10),
c(alpha = 80, beta = 6, gamma = 0.5, zeta = 10),
c(alpha = 80, beta = 6, gamma = -0.5, zeta = 10),
c(alpha = 80, beta = 6, gamma = -0.9, zeta = 10),
c(alpha = 80, beta = 6, gamma = -2.0, zeta = 10)),
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 the other variances at zero), so
# every learner shares the floor and the ceiling but hits fastest
# growth on a different week.
set.seed(113)
d_beta <- simulate_longitudinal_logistic(
n = 25, target_times = seq(0, 12, by = 0.5),
fixed_parameters = c(alpha = 80, beta = 6, gamma = 0.9, zeta = 10),
random_variances = c(beta = 1.2), error_variance = 0
)
plot_trajectories(d_beta, id = "id", time = "time",
outcome = "true_score")
# Unit-specific measurement times: each child is tested at their own
# ages, drawn uniformly between 40 and 90 weeks with five to nine
# visits each, rather than on one shared schedule.
set.seed(113)
d_ages <- simulate_longitudinal_logistic(
n = 12, time_range = c(40, 90), occasions = c(5, 9),
fixed_parameters = c(alpha = 80, beta = 65, gamma = 0.15, zeta = 10),
random_variances = c(beta = 16), error_variance = 4
)
plot_trajectories(d_ages, id = "id", time = "time", outcome = "y")
# Individual differences in every parameter, plus level-one error:
# skill acquisition from a floor near 10 to a ceiling near 90,
# fastest around week 6.
set.seed(113)
d <- simulate_longitudinal_logistic(
n = 30, target_times = 0:12,
fixed_parameters = c(alpha = 80, beta = 6, gamma = 0.9, zeta = 10),
random_variances = c(alpha = 36, beta = 1, 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