Learn R Programming

GMMinit (version 1.0.0)

BestGMM: Select the Best Gaussian Mixture Model (GMM) Based on BIC

Description

Identifies and returns the best Gaussian Mixture Model (GMM) result from multiple initialization strategies by selecting the model with the lowest Bayesian Information Criterion (BIC).

Usage

BestGMM(all_result)

Value

A list describing the selected best GMM model. The returned list contains:

  • best The GMM model object corresponding to the lowest BIC. This object typically contains:

    • BIC The model's BIC value.

    • param A list of estimated GMM parameters:

      • pi_k Mixing proportions.

      • mu Cluster mean matrix.

      • sigma Covariance matrices.

    • cluster Cluster assignments for each observation.

    • Z Posterior probability matrix of cluster memberships.

  • initial_method A character string identifying which initialization method produced the best model.

  • BIC A numeric vector of BIC values for all initialization methods, with NA for failed fits.

If all candidate models fail, best and initial_method

are returned as NULL.

Arguments

all_result

A named list of GMM model results produced by different initialization methods. Each element is typically an output from runGMM() or a similar GMM-fitting function. Failed initializations may appear as NULL.

Details

The BestGMM takes the output from runGMM() and selects the best model by identifying the initialization method that results in the lowest BIC.

See Also

runGMM, runEM

Examples

Run this code
# Generate sample data
set.seed(123)
data <- matrix(rnorm(100 * 2), ncol = 2)

# Run GMM clustering with multiple initialization methods
results <- runGMM(data, k = 2)

# Select the best GMM based on BIC
best_model <- BestGMM(results)

# Print the best model
print(best_model)

Run the code above in your browser using DataLab