# carbikeplotGPCM

carbikeplotGPCM produces the carbike plot to find best relevant clustering solutions

## Syntax

• h=carbikeplotGPCM(RelSol)example
• h=carbikeplotGPCM(RelSol,Name,Value)example

## Description

carbikeplotGPCM takes as input the output of function tclustICsolGPCM (that is a structure containing the best relevant solutions) and produces the car-bike plot. This plot provides a concise summary of the best relevant solutions. This plot shows on the horizontal axis the value of $c_{det}$ and $c_{shw}$ restriction factors and on the vertical axis the value of $k$. For each solution we draw two rectangle (associated with $c_{det}$ and $c_{shw}$) which are respectively referred to interval of values for which the solution is best and stable and a horizontal line which departs from the rectangle for the values of $c_{det}$ ($c_{shw}$) in which the solution is only stable.

Finally, for the best value of $c_{det}$ ($c_{shw}$) associated to the solution, we show a circle with a number indicating the ranked solution among those which are not spurious. This plot has been baptized car-bike'', because the first best solutions (in general 2 or 3) are generally best and stable for a large number of values of $c$ and therefore will have large rectangles. In addition, these solutions are likely to be stable for additional values of $c_det$ ($c_{shw}$) and therefore are likely to have horizontal lines departing from the rectangles (from here the name cars''). Finally, local minor solutions (which are associated with particular values of $c_{det}$ ($c_{shw}$) and $k$) do not generally present rectangles or lines and are shown with circles (from here the name bikes'')

 h =carbikeplotGPCM(RelSol) Simulated data with 3 components.

 h =carbikeplotGPCM(RelSol, Name, Value) car-bike plot for the geyser data.

## Examples

expand all

### Simulated data with 3 components.

Data generation rng('default') Reinitialize the random number generator to its startup configuration

rng(10);
ktrue=3;
% n = number of observations
n=150;
% v= number of dimensions
v=2;
% Imposed average overlap and restriction factor.
BarOmega=0.04;
restrfact=5;
outMS=MixSim(ktrue,v,'BarOmega',BarOmega, 'restrfactor',restrfact);
% data generation given centroids and cov matrices
[Y,id]=simdataset(n, outMS.Pi, outMS.Mu, outMS.S);
% Number of subsets to extract
nsamp=100;
% Computation of information criterion using MIXMIX
outICmixt=tclustICgpcm(Y,'plots',0,'nsamp',nsamp,'kk',1:4);
% Specify number of solutions
NumberOfBestSolutions=3;
% Extract the best solutions using as Information criterion MIXMIX
[outMIXMIX]=tclustICsolGPCM(outICmixt,'whichIC','MIXMIX','plots',0,'NumberOfBestSolutions',NumberOfBestSolutions);
carbikeplotGPCM(outMIXMIX);
k=1
k=2
k=3
k=4


### car-bike plot for the geyser data.

Y=load('geyser2.txt');
out=tclustICgpcm(Y,'cleanpool',false,'plots',0,'alpha',0.1,'nsamp',100,'kk',2:4);
% Find the best solutions using as Information criterion MIXMIX
disp('Best solutions using MIXMIX')
[outMIXMIX]=tclustICsolGPCM(out,'whichIC','MIXMIX','plots',0,'NumberOfBestSolutions',3);
% Produce the car-bike plot
carbikeplotGPCM(outMIXMIX)
k=2
k=3
k=4
Best solutions using MIXMIX

ans =

Figure (2) with properties:

Number: 2
Name: ''
Color: [0.9400 0.9400 0.9400]
Position: [488 242 560 420]
Units: 'pixels'

Use GET to show all properties



## Input Arguments

### RelSol — Relevant solutions produced by function tclustICsolGPCM. Structure.

It contains the following fields:

Value Description
MIXMIXbs

cell of size NumberOfBestSolutions-times-8 which contains the details of the best solutions for MIXMIX (BIC).

Each row refers to a solution. The information which is stored in the columns is as follows.

1st col = scalar, value of k for which solution takes place;

2nd col = scalar, value of cdet for which solution takes place;

3rd col = row vector of length d which contains the values of cdet for which the solution is uniformly better.

4th col = row vector of length d+r which contains the values of cdet for which the solution is considered stable (i.e. for which the value of the adjusted Rand index, or the adjusted Fowlkes and Mallows index) does not go below the threshold defined in input option ThreshRandIndex).

5th col = string which contains 'true' or 'spurious'. The solution is labelled spurious if the value of the adjusted Rand index with the previous solutions is greater than ThreshRandIndex.

6th col = scalar, value of cshw for which solution takes place.

7th col = row vector of length d which contains the values of cshw for which the solution is uniformly better.

8th col = row vector of length d+r which contains the values of cshw for which the solution is considered stable (i.e. for which the value of the adjusted Rand index, or the adjusted Fowlkes and Mallows index) does not go below the threshold defined in input option ThreshRandIndex).

Remark: field out.MIXMIXbs is present only if input option 'whichIC' is 'ALL' or 'whichIC' is 'MIXMIX'.

MIXMIXbsari

matrix of adjusted Rand indexes (or Fowlkes and Mallows indexes) associated with the best solutions for MIXMIX. Matrix of size NumberOfBestSolutions-times-NumberOfBestSolutions whose i,j-th entry contains the adjusted Rand index between classification produced by solution i and solution j, $i,j=1, 2, \ldots, NumberOfBestSolutions$.

Remark: field out.MIXMIXbsari is present only if 'whichIC' is 'ALL' or 'whichIC' is 'MIXMIX'.

MIXCLAbs

this output has the same structure as out.MIXMIXbs but it is referred to MIXCLA.

Remark: field out.MIXCLAbs is present only if 'whichIC' is 'ALL' or 'whichIC' is 'MIXCLA'.

MIXCLAbsari

this output has the same structure as out.MIXMIXbs but it is referred to MIXCLA.

Remark: field out.MIXCLAbsari is present only if 'whichIC' is 'ALL' or 'whichIC' is 'MIXCLA'.

CLACLAbs

this output has the same structure as out.MIXMIXbs but it is referred to CLACLA.

Remark: field out.CLACLAbs is present only if 'whichIC' is 'ALL' or 'whichIC' is 'CLACLA'.

CLACLAbsari

this output has the same structure as out.MIXMIXbs but it is referred to CLACLA.

Remark: field out.MIXCLAbsari is present only if 'whichIC' is 'ALL' or 'whichIC' is 'CLACLA'

kk

vector containing the values of k (number of components) which have been considered.

ccdet

vector containing the values of cdet (values of the restriction factor for determinants) which have been considered.

ccshw

vector containing the values of cshw (values of the restriction factor for shape elements inside each group) which have been considered.

out.alpha = scalar containing the value of $\alpha$ (trimming level) which has been considered.

Data Types: struct

### Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as  Name1,Value1,...,NameN,ValueN.

Example:  'SpuriousSolutions',false 

### SpuriousSolutions —Include or nor spurious solutions.boolean.

As default spurios solutions are not included into the plot.

Example:  'SpuriousSolutions',false 

Data Types: logical

## Output Arguments

### h —graphics handle to the plot. Graphics handle

Graphics handle which is produced on the screen.

## References

Cerioli, A. Garcia-Escudero, L.A., Mayo-Iscar, A. and Riani, M. (2017), Finding the Number of Groups in Model-Based Clustering via Constrained Likelihoods, "Journal of Computational and Graphical Statistics", pp. 404-416, https://doi.org/10.1080/10618600.2017.1390469