slopeHeuristic | R Documentation |

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.

```
slopeHeuristic(x, plot = FALSE)
```

`x` |
An |

`plot` |
Logical, default is |

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.

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. |

```
# 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
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.