Learn R Programming

DPCD (version 0.0.1)

plot_objects: Plot the Object Configuration

Description

Generates a plot of the posterior mean of the latent coordinates (x) from a DPCD model fit, aligned to a specified target matrix using a Procrustes transformation.

Usage

plot_objects(mcmc_samples, target_matrix, show_clusters = TRUE, ...)

Value

A scatter plot (for 2-dimensional latent space) or pairs plot (for higher dimensions) of the object configuration.

Arguments

mcmc_samples

An object of class mcmc or mcmc.list containing posterior samples from a DPCD model fit using run_dpcd(). Variable x must be included in the output parameters.

target_matrix

A matrix used as the target for aligning the posterior latent coordinates (x) via a Procrustes transformation.

show_clusters

Logical argument indicating whether to colour points by their cluster membership. If TRUE, then z must be included in mcmc_samples.

...

Additional arguments to be passed to plot() (2 dimensions) or pairs() (higher dimensions).

Details

Since the latent coordinates are non-identifiable due to invariance of Euclidean distances to rotation, reflection, and translation, this function first aligns the posterior samples of x to a specified target matrix using a Procrustes transformation. Then, it computes the posterior mean of the aligned latent coordinates and generates a plot. If show_clusters is set to TRUE, points are coloured according to their cluster memberships, which is estimated through maximizing the posterior expected adjusted Rand index (Fritsch and Ickstadt, 2009).

References

Fritsch, Arno & Ickstadt, Katja. (2009). An Improved Criterion for Clustering Based on the Posterior Similarity Matrix. Bayesian Analysis. 4. doi:10.1214/09-BA414.

Examples

Run this code
target_matrix <- cmdscale(dis_mat_example, k = 2)
plot_objects(mcmc_example, target_matrix, show_clusters = TRUE)

Run the code above in your browser using DataLab