Description Usage Arguments Value Author(s) References See Also Examples

Computesthe *I*I* matrix **D** which is the *chi2*
distance matrix between the rows of
an *I*J* rectangular matrix **X** (with non-negative elements),
and provides the *I*1*
**m** vector of mass (where the mass of a row is the sum of the entries of
this row divided by the grand total of the matrix).
When the distance matrix and
the associated vector of masses are
used as input to the function `mmds`

the
results will give the factor scores
of the correspondence analysis of the matrix **X**.
The `function`

is used by the function
`Chi2DistanceFromSort`

that computes
the *chi2* distance for the results of a sorting task.

1 2 | ```
Chi2Dist(X)
``` |

`X` |
A rectangle matrix with non-negative elements |

Sends back a list

`$Distance` |
the squared |

`masses` |
the vector of masses of the rows of of matrix |

Herve Abdi

The procedure and references are detailled in (Paper available from www.utdallas.edu/~herve):
Abdi, H. (2007). Distance.
In N.J. Salkind (Ed.):
*Encyclopedia of Measurement and Statistics*. Thousand Oaks (CA): Sage. pp. 304–308.

And in:

Abdi, H., & Valentin, D. (2006).
*Mathematiques pour les Sciences Cognitives (Mathematics for Cognitive Sciences).*
Grenoble: PUG.

See also (for the example):

Abdi, H., & Williams, L.J. (2010). Principal component analysis.
*Wiley Interdisciplinary Reviews: Computational Statistics*,**2**, 433–459.

`Chi2DistanceFromSort`

`distatis`

`mmds`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ```
# Here is a data matrix from Abdi & Williams (2012)
# page 449, Table 15. Punctuation of 6 French authors
Punctuation = matrix(c(
7836, 13112, 6026,
53655, 102383, 42413,
115615, 184541, 59226,
161926, 340479, 62754,
38177, 105101, 12670,
46371, 58367, 14299),
ncol =3,byrow = TRUE)
colnames(Punctuation) <-c('Period','Comma','Other')
rownames(Punctuation) <-c('Rousseau','Chateaubriand',
'Hugo','Zola','Proust','Giroudoux')
# 1. Get the Chi2 distance matrix
# between the rows of Punctuation
Dres <- Chi2Dist(Punctuation)
# check that the mds of the Chi2 distance matrix
# with CA-masses gives the CA factor scores for I
# 2. Use function mmds from DistatisR
#
testmds <- mmds(Dres$Distance,masses=Dres$masses)
# Print the MDS factor scores from mmds
print('Factor Scores from mds')
print(testmds$FactorScores)
print('It matches CA on X (see Abdi & Williams, 2010. Table 16, p. 449)')
# Et voila!
``` |

DistatisR documentation built on May 29, 2017, 9:18 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.