data("jz2017")
scales <- c("PA", "BC", "DE", "FG", "HI", "JK", "LM", "NO")
# Three occasions that actually move: shifting the octant scores by one
# position rotates the fitted profile by 45 degrees per occasion.
waves <- lapply(1:3, function(k) {
idx <- ((seq_along(scales) - 1 + (k - 1)) %% length(scales)) + 1
d <- jz2017[, scales[idx]]
names(d) <- scales
d$id <- seq_len(nrow(d))
d$occasion <- paste0("T", k)
d
})
res <- ssm_analyze_long(do.call(rbind, waves),
scales = scales, id = "id", occasion = "occasion"
)
ggcircumplex(octants(), amax = 0.5) +
geom_ssm_point(
data = res$results,
mapping = ggplot2::aes(amplitude = a_est, displacement = d_est),
size = 2
) +
geom_ssm_path(
data = res$results,
mapping = ggplot2::aes(amplitude = a_est, displacement = d_est),
arrow = ggplot2::arrow(
length = ggplot2::unit(0.18, "inches"), type = "closed"
)
)
Run the code above in your browser using DataLab