slopeHeuristic {HDclassif} | R Documentation |
Slope Heuristic for HDDC objects
Description
This function computes the slope heuristic for a set of objects obtained by the function hddc
. The slope heuristic is a criterion in which the likelihood is penalized according to the result of the fit of the likelihoods on the complexities of the models.
Usage
slopeHeuristic(x, plot = FALSE)
Arguments
x |
An |
plot |
Logical, default is |
Details
This function is only useful if there are many models (at least 3, better if more) that were estimated by the function hddc
. If there are less than 2 models, the function wil l return an error.
Value
A list of two elements:
best_model_index |
The index of the best model, among all estimated models. |
allCriteria |
The data.frame containing all the criteria, with the new slope heuristic. |
Examples
# Clustering of the Crabs data set
data(Crabs)
prms = hddc(Crabs[,-1], K = 1:10) # we estimate ten models
slope = slopeHeuristic(prms, plot = TRUE)
plot(slope$allCriteria) # The best model is indeed for 4 clusters
prms$all_results[[slope$best_model_index]] # we extract the best model