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 SANvb, the output of one of the variational functions variational_CAM, variational_fiSAN, variational_fSAN.

ordered

logical, if TRUE (default), the function sorts the distributional cluster labels reflecting the increasing values of medians of the data assigned to each DC.

x

an object of class variational_estimates, which can be obtained from the function estimate_atoms_weights_vi.

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 R base colors (palette_brewed = FALSE).

...

ignored.

Value

a list of class clustering containing

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)


[Package SANvi version 0.1.1 Index]