How to do it...

We will work with the geyser2 dataset, which contains two features (eruption length and previous eruption length). The objective is to cluster the data into three groups, taking care of the fact that there is a distinct covariance pattern in each cluster.

  1. First, we load the library, which includes the geyser2 dataset:
library(qclust)data ("geyser2")
  1. We estimate our clusters, using the qclust function. We want to get three clusters, and we set the q (robust parameter) to 0.99. We plot the clusters and the densities:
result_robust_mixture <- qclust::Qclust(geyser2,K=3,q=0.9999)plot(result_robust_mixture)

Estimated clusters—these covariance matrices are not very robust. The blue cluster seems to be suffering from the small ...

Get R Statistics Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.