plot.net_mmm_clustering: Plot Method for MMM Clustering Attribute

View source: R/mmm.R

plot.net_mmm_clusteringR Documentation

Plot Method for MMM Clustering Attribute

Description

Plot routines for the MMM clustering metadata attached to a netobject_group by cluster_mmm (or cluster_network with cluster_by = "mmm"). Mirrors the type-driven surface of plot.net_clustering but covers only the metrics the EM fit produces – there is no distance matrix on an MMM clustering, so "silhouette" / "mds" / "heatmap" aren't defined here and the dispatcher raises a clear error if you ask for one of those on an MMM result.

Usage

## S3 method for class 'net_mmm_clustering'
plot(
  x,
  type = c("posterior", "covariates", "predictors"),
  combined = TRUE,
  ...
)

Arguments

x

A net_mmm_clustering object.

type

Character. One of "posterior" (default; histogram of max posterior probability per sequence, coloured by cluster), "covariates" or its alias "predictors" (covariate forest plot when cluster_mmm() was run with covariates).

combined

Logical. For type in "covariates" or "predictors" only: when TRUE (default), forest panels are combined into a single faceted plot; when FALSE, a list of separate ggplots is returned.

...

Unsupported. Supplying unused arguments raises an error.

Value

A ggplot object, invisibly.

Examples


seqs <- data.frame(V1 = sample(c("A","B","C"), 40, TRUE),
                   V2 = sample(c("A","B","C"), 40, TRUE))
grp <- cluster_mmm(seqs, k = 2, n_starts = 1, max_iter = 20, seed = 1)
plot(attr(grp, "clustering"), type = "posterior")


Nestimate documentation built on July 11, 2026, 1:09 a.m.