### DisTools examples: Characterization of Dissimilarity Matrices

Dissimilarity matrices may be non-Euclidean, non-metric, have some complexity defined in various ways. Some examples will be treated. It is assumed that readers are familiar with PRTools and will consult the following pages where needed:

display, pca, classical scaling, asymmetry, nef, intrdim, disstat, signature, ner, trineq, subeucl, nnerror

Some figures to inspect the data of a given dissimilarity matrix:

`delfigs`
`D = chickenpieces(29,45)*makesym;`
`figure; imagesc(+D);`
`title('Dissimilarity matrix')`
`W = D*pe_em;`
`figure; scatterd(D*W(:,[1 2]));`
`title('Embedding, first 2 features')`
`[p,q] = getsig(W);`
`figure; scatterd(D*W(:,[1 p+1]))`
`title('PE space'); `
` xlabel('First positive feature')`
` ylabel('First negative feature')`
`figure; plotspectrum(W);`
`showfigs`

Some properties:

`D = chickenpieces(29,45);`
`fprintf('Number of objects:        %6.0fn',size(D,1));```` fprintf('Number of classes:        %6.0fn',getsize(D,3));```
```fprintf('Asymmetry:                %6.4fn',D*asymmetry); D = D*makesym;```
`[f,r] = nef(D*pe_em);`
` fprintf('Negative eigen-fraction:  %6.4fn',f);`
` fprintf('Negative eigen-ratio:     %6.4fn',r);`
` fprintf('Intrinsic dimensionality: %6.0fn',intrdim(D));`
` [p,c] = D*disnorm(D)*nmf;`
` fprintf('Non-metric fraction:      %6.4fn',p);`
` fprintf('Non-metricity:            %6.4fn',c);`
` fprintf('LOO NN error:             %6.4fn',nne(D))`

Study the meanings of these properties from the help files.

#### Exercise

Study the behavior of the negative eigenfraction `nef` as a function of the number of objects used for the construction of the dissimilarity matrix. Use a larger dataset like `zongker` (2000 x 2000) and take subsets of various sizes by `genddat`.