# getDistMatrix: Dissimilarity matrix between individuals and prototypes In Anthropometry: Statistical Methods for Anthropometric Data

 getDistMatrix R Documentation

## Dissimilarity matrix between individuals and prototypes

### Description

In the definition of a sizing system, a distance function allows us to represent mathematically the idea of garment fit and it is a key element to quantify the misfit between an individual and the prototype.

This function computes the dissimilarity defined in McCulloch et al. (1998), which is used in `trimowa` and `hipamAnthropom`. For more details, see also Ibanez et al. (2012) and Vinue et al. (2014).

### Usage

```getDistMatrix(data,np,nv,w,bl,bh,al,ah,verbose)
```

### Arguments

 `data` Data vector. `np` Number of observations in the database. `nv` Number of variables in the database. `w` Weights for the OWA operator computed by means of `weightsMixtureUB`. `bl,bh,al,ah` Constants required to specify the distance function. `verbose` Boolean variable (TRUE or FALSE) to indicate whether to report information on progress.

### Details

At the computational level, it is asummed that all the `bh` values are negative, all the `bl` values are positive and all the `al` and `ah` slopes are positive (the sign of `al` is changed within the function when computing the dissimilarities).

### Value

A symmetric `np` x `np` matrix of dissimilarities.

### Note

This function requires a C code called cast.c. In order to use `getDistMatrix` outside the package, the dynamic-link library is called by means of the sentence `dyn.load("cast.so")` (In Windows, it would be `dyn.load("cast.dll")`).

Juan Domingo

### References

McCulloch, C., Paal, B., and Ashdown, S., (1998). An optimization approach to apparel sizing, Journal of the Operational Research Society 49, 492–499.

Ibanez, M. V., Vinue, G., Alemany, S., Simo, A., Epifanio, I., Domingo, J., and Ayala, G., (2012). Apparel sizing using trimmed PAM and OWA operators, Expert Systems with Applications 39, 10512–10520.

Vinue, G., Leon, T., Alemany, S., and Ayala, G., (2014). Looking for representative fit models for apparel sizing, Decision Support Systems 57, 22–33.

Leon, T., Zuccarello, P., Ayala, G., de Ves, E., and Domingo, J., (2007), Applying logistic regression to relevance feedback in image retrieval systems, Pattern Recognition 40, 2621–2632.

`trimowa`, `hipamAnthropom`

### Examples

```#Data loading:
dataTrimowa <- sampleSpanishSurvey
bust <- dataTrimowa\$bust
#First bust class:
data <- dataTrimowa[(bust >= 74) & (bust < 78), ]
numVar <- dim(dataTrimowa)[2]

#Weights calculation:
orness <- 0.7
weightsTrimowa <- weightsMixtureUB(orness,numVar)

#Constants required to specify the distance function:
numClust <- 3
bh <- (apply(as.matrix(log(data)),2,range)[2,]
- apply(as.matrix(log(data)),2,range)[1,]) / ((numClust-1) * 8)
bl <- -3 * bh
ah <- c(23,28,20,25,25)
al <- 3 * ah

#Data processing.
num.persons <- dim(data)[1]
num.variables <- dim(data)[2]
datam <- as.matrix(data)
datat <- aperm(datam, c(2,1))
dim(datat) <- c(1,num.persons * num.variables)

#Dissimilarity matrix:
D <- getDistMatrix(datat, num.persons, numVar, weightsTrimowa, bl, bh, al, ah, FALSE)
```

Anthropometry documentation built on March 7, 2023, 6:58 p.m.