estimate_clustering_vi {SANvi} | R Documentation |
Estimate Posterior Clustering Assignments
Description
This function estimates posterior clustering assignments based on posterior variational estimates obtained from one of the model implemented in SANvi.
Usage
estimate_clustering_vi(output, ordered = TRUE)
## S3 method for class 'vi_clustering'
plot(
x,
DC_num = NULL,
type = c("ecdf", "boxplot", "scatter"),
palette_brewed = FALSE,
...
)
## S3 method for class 'vi_clustering'
print(x, ...)
Arguments
output |
an object of class |
ordered |
logical, if |
x |
an object of class |
DC_num |
an integer or a vector of integers indicating which distributional clusters to plot. |
type |
what type of plot should be drawn (only for the left-side plot). Possible types are "boxplot", "ecdf", and "scatter". |
palette_brewed |
(logical) the color palette to be used. Default is |
... |
ignored. |
Value
a list of class clustering
containing
-
obs_level
: a data frame containing the data values, their group indexes, the observational and distributional clustering assignments for each observation. -
dis_level
: a vector with the distributional clustering assignment for each unit.
See Also
variational_CAM
, variational_fiSAN
, variational_fSAN
, extract_best
.
Examples
# Generate example data
set.seed(123)
y <- c(rnorm(100),rnorm(100,-5),rnorm(100,5),rnorm(100),
rnorm(100),rnorm(100,-5),rnorm(100,5),rnorm(100))
g <- rep(1:4,rep(200,4))
# Fitting fiSAN via variational inference
est <- SANvi::variational_fiSAN(y,g,verbose = FALSE)
# Estimate clustering assignments
estimate_clustering_vi(est)