plot.multilpa_additive: Plot an additive group-class fit

View source: R/additive-methods.R

plot.multilpa_additiveR Documentation

Plot an additive group-class fit

Description

"means" shows each group class's mean per indicator with its Wald interval (when the fit supports inference). "variances" sets the shared within-group variance beside each between-group variance. "intercepts" shows every group's posterior intercept mean, marked by its modal class, with the class means over them. Classes are distinguished by colour and by point shape.

Usage

## S3 method for class 'multilpa_additive'
plot(
  x,
  what = c("means", "variances", "intercepts"),
  level = 0.95,
  main = NULL,
  subtitle = NULL,
  ...
)

Arguments

x

A multilpa_additive fit.

what

Which view.

level

Confidence level of the intervals.

main, subtitle

Optional title and subtitle.

...

Unused.

Value

A ggplot object. Raises latents_missing_package without ggplot2.

Examples

if (requireNamespace("ggplot2", quietly = TRUE)) {
  set.seed(1)
  ratings <- data.frame(
    team = rep(seq_len(40), each = 6),
    climate = rep(rnorm(40, rep(c(-1, 1), each = 20), 0.5), each = 6) +
      rnorm(240),
    support = rep(rnorm(40, rep(c(-1, 1), each = 20), 0.5), each = 6) +
      rnorm(240))
  fit <- multilpa(ratings, c("climate", "support"), "team",
                  n_group_classes = 2, family = "additive", n_starts = 3,
                  seed = 1)
  plot(fit)
  plot(fit, what = "intercepts")
}

latents documentation built on Oct. 16, 2026, 5:09 p.m.