Variable Selection for Model-Based Clustering of Mixed-Type Data Set with Missing Values
Variable Selection for Model-Based Clustering of Mixed-Type Data Set with Missing Values
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.
package
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.
Standard tool methods (e.g., summary , print , plot , coef , fitted , predict ...) are available for facilitating the interpretation.
Examples
## Not run:# Package loadingrequire(VarSelLCM)# Data loading:# x contains the observed variables# z the known statu (i.e. 1: absence and 2: presence of heart disease)data(heart)ztrue <- heart[,"Class"]x <- heart[,-13]# Cluster analysis without variable selectionres_without <- VarSelCluster(x,2, vbleSelec =FALSE, crit.varsel ="BIC")# Cluster analysis with variable selection (with parallelisation)res_with <- VarSelCluster(x,2, nbcores =2, initModel=40, crit.varsel ="BIC")# Comparison of the BIC for both models:# variable selection permits to improve the BICBIC(res_without)BIC(res_with)# Comparison of the partition accuracy. # ARI is computed between the true partition (ztrue) and its estimators# ARI is an index between 0 (partitions are independent) and 1 (partitions are equals)# variable selection permits to improve the ARI# Note that ARI cannot be used for model selection in clustering, because there is no true partitionARI(ztrue, fitted(res_without))ARI(ztrue, fitted(res_with))# Estimated partitionfitted(res_with)# Estimated probabilities of classificationhead(fitted(res_with, type="probability"))# Summary of the probabilities of missclassificationplot(res_with, type="probs-class")# Confusion matrices and ARI (only possible because the "true" partition is known).# ARI is computed between the true partition (ztrue) and its estimators# ARI is an index between 0 (partitions are independent) and 1 (partitions are equals)# variable selection permits to improve the ARI# Note that ARI cannot be used for model selection in clustering, because there is no true partition# variable selection decreases the misclassification error ratetable(ztrue, fitted(res_without))table(ztrue, fitted(res_with))ARI(ztrue, fitted(res_without))ARI(ztrue, fitted(res_with))# Summary of the best modelsummary(res_with)# Discriminative power of the variables (here, the most discriminative variable is MaxHeartRate)plot(res_with)# More detailed outputprint(res_with)# Print model parametercoef(res_with)# Boxplot for the continuous variable MaxHeartRateplot(x=res_with, y="MaxHeartRate")# Empirical and theoretical distributions of the most discriminative variable# (to check that the distribution is well-fitted)plot(res_with, y="MaxHeartRate", type="cdf")# Summary of categorical variableplot(res_with, y="Sex")# Probabilities of classification for new observations predict(res_with, newdata = x[1:3,])# Imputation by posterior mean for the first observationnot.imputed <- x[1,]imputed <- VarSelImputation(res_with, x[1,], method ="sampling")rbind(not.imputed, imputed)# Opening Shiny application to easily see the resultsVarSelShiny(res_with)## End(Not run)
References
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.