## Transformation to make Euclidean a distance matrix

### Description

This function computes the smallest positive constant that makes Euclidean a distance matrix and applies it.

### Usage

```cailliez(distmat, print = FALSE)
```

### Arguments

 `distmat` an object of class `dist` `print` if TRUE, prints the eigenvalues of the matrix

### Value

an object of class `dist` containing a Euclidean distance matrix.

### Author(s)

Daniel Chessel
Stéphane Dray dray@biomserv.univ-lyon1.fr

### References

Cailliez, F. (1983) The analytical solution of the additive constant problem. Psychometrika, 48, 305–310.

Legendre, P. and Anderson, M.J. (1999) Distance-based redundancy analysis: testing multispecies responses in multifactorial ecological experiments. Ecological Monographs, 69, 1–24.

Legendre, P., and Legendre, L. (1998) Numerical ecology, 2nd English edition edition. Elsevier Science BV, Amsterdam.

From the DistPCoa program of P. Legendre et M.J. Anderson
http://www.fas.umontreal.ca/BIOL/Casgrain/en/labo/distpcoa.html

### Examples

```data(capitales)
d0 <- as.dist(capitales\$df)
is.euclid(d0) # FALSE
d1 <- cailliez(d0, TRUE)
# Cailliez constant = 2429.87867
is.euclid(d1) # TRUE
plot(d0, d1)
abline(lm(unclass(d1)~unclass(d0)))
print(coefficients(lm(unclass(d1)~unclass(d0))), dig = 8) # d1 = d + Cte
is.euclid(d0 + 2428) # FALSE
is.euclid(d0 + 2430) # TRUE the smallest constant
```

### Worked out examples

```
> ### Name: cailliez
> ### Title: Transformation to make Euclidean a distance matrix
> ### Aliases: cailliez
> ### Keywords: array
>
> ### ** Examples
>
> data(capitales)
> d0 <- as.dist(capitales\$df)
> is.euclid(d0) # FALSE
[1] FALSE
> d1 <- cailliez(d0, TRUE)
Cailliez constant = 2429.87867
> # Cailliez constant = 2429.87867
> is.euclid(d1) # TRUE
[1] TRUE
> plot(d0, d1)
```
```> abline(lm(unclass(d1)~unclass(d0)))
```
```> print(coefficients(lm(unclass(d1)~unclass(d0))), dig = 8) # d1 = d + Cte
(Intercept) unclass(d0)
2429.8787      1.0000
> is.euclid(d0 + 2428) # FALSE
[1] FALSE
> is.euclid(d0 + 2430) # TRUE the smallest constant
[1] TRUE
>
>
>
>
```