Skip to contents

Heatmap of pairwise posterior co-clustering probabilities.

Usage

# S3 method for class 'dpmixgpd_cluster_psm'
plot(
  x,
  psm_max_n = x$psm_max_n %||% 2000L,
  plotly = getOption("CausalMixGPD.plotly", FALSE),
  ...
)

Arguments

x

Cluster PSM object.

psm_max_n

Maximum allowed matrix size for plotting.

plotly

Logical; if TRUE, convert the ggplot2 output to a plotly / htmlwidget representation via .wrap_plotly(). Defaults to getOption("CausalMixGPD.plotly", FALSE).

...

Unused.

Value

A ggplot2 object or a plotly/htmlwidget object when plotly = TRUE.

Details

The heatmap visualizes the matrix $$ \mathrm{PSM}_{ij} \approx \frac{1}{S} \sum_{s=1}^S I(z_i^{(s)} = z_j^{(s)}), $$ so larger values indicate pairs of observations that are stably allocated to the same cluster over the retained posterior draws.

Because the PSM is an \(n \times n\) object, plotting and even storing it becomes expensive for large n. The psm_max_n argument is therefore a deliberate guard against accidental quadratic memory use.