Learn R Programming

BayesChange (version 2.3.0)

plot_psm.ClustCpObj: Plot the Posterior Similarity Matrix (PSM) for a ClustCpObj

Description

This function computes and visualizes the posterior similarity matrix (PSM) from a ClustCpObj object. The PSM shows the posterior co-clustering probabilities of all observations.

Usage

# S3 method for ClustCpObj
plot_psm(object, reorder = TRUE, title = "Posterior Similarity Matrix", ...)

Value

A ggplot2 object representing the posterior similarity matrix.

Arguments

object

an object of class ClustCpObj.

reorder

Logical; if TRUE (default), items are reordered using hierarchical clustering to highlight clusters in the final plot

title

Character; the plot title (default: "Posterior Similarity Matrix").

...

parameter of the generic method.

Examples

Run this code
data("stock_uni")

params_uni <- list(a = 1,
                   b = 1,
                   c = 1,
                   phi = 0.1)

out <- clust_cp(data = stock_uni[1:3,], n_iterations = 1000, n_burnin = 100,
                L = 1, q = 0.5, B = 500, params = params_uni, kernel = "ts")
plot_psm(out)

Run the code above in your browser using DataLab