Chi2Dist {DistatisR} | R Documentation |
Computes the \chi^2
distance between
the rows of a rectangular matrix (with positive elements).
Description
Chi2Dist
:
Computes
the I\times I
matrix D which is the
\chi^2
distance matrix between
the rows of an I\times J
rectangular matrix X
(with non-negative elements), and
provides the I\times 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 \chi^2
distance for the results of a sorting task.
Usage
Chi2Dist(X)
Arguments
X |
A rectangle matrix with non-negative elements |
Value
Sends back a list:
$Distance |
the squared |
masses |
the vector of masses of the rows of of matrix X. |
Author(s)
Herve Abdi
References
The procedure and references are detailled in (Paper available from https://personal.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.
See Also
Chi2DistanceFromSort
distatis
mmds
Examples
# 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!