Model-based clustering with variable selection and estimation of the number of clusters. Data to analyze can be continuous, categorical, integer or mixed. Moreover, missing values can occur and do not necessitate any pre-processing. Shiny application permits an easy interpretation of the results.
The main function to use is VarSelCluster. Function VarSelCluster carries out the model selection (according to AIC, BIC or MICL) and maximum likelihood estimation.
Function VarSelShiny runs a shiny application which permits an easy interpretation of the clustering results.
Function VarSelImputation permits the imputation of missing values by using the model parameters.
Tool methods summary, print and plot are also available for facilitating the interpretation.
Matthieu Marbac and Mohammed Sedki Maintainer: Mohammed Sedki <[email protected]>
Marbac, M. and Sedki, M. (2017). Variable selection for model-based clustering using the integrated completed-data likelihood. Statistics and Computing, 27 (4), 1049-1063.
Marbac, M. and Patin, E. and Sedki, M. (2018). Variable selection for mixed data clustering: Application in human population genomics. Journal of classification, to appear.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
## Not run: # Package loading require(VarSelLCM) # Data loading: # x contains the observed variables # z the known statu (i.e. 1: absence and 2: presence of heart disease) data(heart) z <- heart[,"Class"] x <- heart[,-13] # Cluster analysis without variable selection res_without <- VarSelCluster(x, 2, vbleSelec = FALSE) # Cluster analysis with variable selection (with parallelisation) res_with <- VarSelCluster(x, 2, nbcores = 2, initModel=40) # Confusion matrices and ARI: variable selection decreases the misclassification error rate print(table(z, res_without@partitions@zMAP)) print(table(z, res_with@partitions@zMAP)) ARI(z, res_without@partitions@zMAP) ARI(z, res_with@partitions@zMAP) # Summary of the best model summary(res_with) # Parameters of the best model print(res_with) # Opening Shiny application to easily see the results VarSelShiny(res_with) # Discriminative power of the variables (here, the most discriminative variable is MaxHeartRate) plot(out, type="bar") # Boxplot for continuous (or interger) variable plot(out, y="MaxHeartRate", type="boxplot") # Empirical and theoretical distributions (to check that clustering is pertinent) plot(out, y="MaxHeartRate", type="cdf") # Summary of categorical variable plot(out, y="Sex") # Summary of the probabilities of missclassification plot(out, type="probs-class") # Imputation by posterior mean for the first observation not.imputed <- heart[1,-13] imputed <- VarSelImputation(out)[1,] rbind(not.imputed, imputed) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.