View source: R/ggplot_number_of_clusters_trace.R
ggplot_number_of_clusters_trace | R Documentation |
A function that produces a ggplot2 trace plot (i.e., geom_line) with respect to the posterior number of clusters.
ggplot_number_of_clusters_trace(.posterior_number_of_clusters)
.posterior_number_of_clusters |
Vector of positive integers: each (s)th element denotes the number of clusters after posterior sampling
for each iteration s = 1, 2, ..., |
ggplot2 geom_line plot: a plot of the posterior number of clusters in each Gibbs sampling iteration versus the Gibbs sampling iteration number.
# Import the tip library library(tip) # Generate a vector of positive integers # Example: the posterior number of clusters computed after posterior # sampling in each sampling iteration of the Gibbs sampler. num_clusters <- c(1,2,2,2,2,3,3,1,2,3,3,3,1,3) # Generate the plot of the posterior number of clusters versus the # sampling iteration number in the Gibbs sampler. ggplot_number_of_clusters_trace(.posterior_number_of_clusters = num_clusters)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.