mdsdd | R Documentation |
Applies the multidimensional scaling (MDS) method to discrete probability distributions in order to describe T
groups of individuals on which are observed q
categorical variables. It returns an object of class
mdsdd
. It applies cmdscale
to the distance matrix between the T
distributions.
mdsdd(xf, group.name = "group", distance = c("l1", "l2", "chisqsym", "hellinger",
"jeffreys", "jensen", "lp"), nb.factors = 3, nb.values = 10, association = c("cramer",
"tschuprow", "pearson", "phi"), sub.title = "", plot.eigen = TRUE,
plot.score = FALSE, nscore = 1:3, filename = NULL, add = TRUE, p)
xf |
object of class
|
group.name |
string. Name of the grouping variable. Default: |
distance |
The distance or divergence used to compute the distance matrix between the discrete distributions (see Details). It can be:
|
nb.factors |
numeric. Number of returned principal coordinates (default Warning: The |
nb.values |
numeric. Number of returned eigenvalues (default |
association |
The association measure between two discrete distributions to be used (see Details). It can be:
|
sub.title |
string. Subtitle for the graphs (default |
plot.eigen |
logical. If |
plot.score |
logical. If |
nscore |
numeric vector. If |
filename |
string. Name of the file in which the results are saved. By default ( |
add |
logical indicating if an additive constant should be computed and added to the non diagonal dissimilarities such that the modified dissimilarities are Euclidean (default |
p |
integer. Optional. When |
If a folder is given as argument, the T
discrete probability distributions f_t
corresponding to the T
groups of individuals are estimated from observations.
Then the distances/dissimilarities between the estimated distributions are computed, using the distance or divergence defined by the distance
argument:
If the distance is "l1"
, "l2"
or "lp"
, the distances are computed by the function matddlppar
.
Otherwise, it can be computed by matddchisqsympar
("chisqsym"
), matddhellingerpar
("hellinger"
), matddjeffreyspar
("jeffreys"
) or matddjensenpar
("jensen"
).
The association measures are computed accordingly to the value of the parameter association
The computation uses the corresponding function of the package DescTools
(see Assocs
). Notice that an association measure between a constant variable with and other variable is set to zero. The association measure between each variable with itself is not computed and the diagonal of the returned association matrices is set to NA
.
Returns an object of class mdsdd
, that is a list including:
inertia |
data frame of the eigenvalues and the percentages of their sum. |
scores |
data frame of the coordinates along the |
jointp |
list of arrays. The joint probability distribution for each group. |
margins |
list of two data frames giving respectively:
|
associations |
list of |
Rachid Boumaza, Pierre Santagostini, Smail Yousfi, Sabine Demotes-Mainard
Cox, T.F., Cox, M.A.A. (2001). Multidimensional Scaling, second ed. Chapman & Hall/CRC.
Saporta, G. (2006). Probabilit\'es, Analyse des donn\'ees et Statistique. Editions Technip, Paris.
print.mdsdd, plot.mdsdd, interpret.mdsdd
# Example 1 with a folder (10 groups) of 3 factors
# obtained by converting numeric variables
data(roses)
xr = roses[,c("Sha", "Den", "Sym", "rose")]
xf = as.folder(xr, groups = "rose")
xf = cut(xf, breaks = list(c(0, 5, 7, 10), c(0, 4, 6, 10), c(0, 6, 8, 10)), cutcol = 1:3)
af = mdsdd(xf)
print(af)
print(af$jointp)
print(af$margins[[1]]) # equivalent to print(af$margins$margin1)
print(af$margins[[2]])
print(af$associations)
# Example 2 with a data frame obtained by converting numeric variables
data(roses)
xr = roses[,c("Sha", "Den", "Sym", "rose")]
xr = cut(xr, breaks = list(c(0, 5, 7, 10), c(0, 4, 6, 10), c(0, 6, 8, 10)), cutcol = 1:3)
ar = mdsdd(xr, group.name = "rose")
print(ar)
print(ar$jointp)
print(ar$margins[[1]]) # equivalent to print(ar$margins$margin1)
print(ar$margins[[2]])
print(ar$associations)
# Example 3 with a list of 7 arrays
data(dspg)
xl = dspg
mdsdd(xl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.