Description Usage Arguments Details Value References See Also Examples
Weighted classical multidimensional scaling, also known as weighted principal coordinates analysis.
1 2 3 4 5 |
d |
a distance structure such as that returned by |
k |
the dimension of the space which the data are to be represented in; must be in {1,2,…,n-1}. If missing, all dimensions with above zero eigenvalue. |
eig |
indicates whether eigenvalues should be returned. |
add |
logical indicating if an additive constant c* should be computed, and added to the non-diagonal dissimilarities such that all n-1 eigenvalues are non-negative. Not implemented. |
x.ret |
indicates whether the doubly centred symmetric distance matrix should be returned. |
w |
Weights of points. |
x |
The |
choices |
Axes to be returned; |
type |
Type of graph which may be |
... |
Other arguments passed to graphical functions. |
Function wcmdscale
is based on function
cmdscale
(package stats of base R), but it uses
point weights. Points with high weights will have a stronger
influence on the result than those with low weights. Setting equal
weights w = 1
will give ordinary multidimensional scaling.
With default options, the function returns only a matrix of scores
scaled by eigenvalues for all real axes. If the function is called
with eig = TRUE
or x.ret = TRUE
, the function returns
an object of class "wcmdscale"
with print
,
plot
, scores
, eigenvals
and
stressplot
methods, and described in section Value.
If eig = FALSE
and x.ret = FALSE
(default), a
matrix with k
columns whose rows give the coordinates of
points corresponding to positive eignenvalues. Otherwise, an object
of class wcmdscale
containing the components that are mostly
similar as in cmdscale
:
points |
a matrix with |
eig |
the n-1 eigenvalues computed during the scaling
process if |
x |
the doubly centred and weighted distance matrix if
|
GOF |
Goodness of fit statistics for |
weights |
Weights. |
negaxes |
A matrix of scores for axes with negative eigenvalues
scaled by the absolute eigenvalues similarly as
|
call |
Function call. |
Gower, J. C. (1966) Some distance properties of latent root and vector methods used in multivariate analysis. Biometrika 53, 325–328.
Mardia, K. V., Kent, J. T. and Bibby, J. M. (1979). Chapter 14 of Multivariate Analysis, London: Academic Press.
The function is modelled after cmdscale
, but adds
weights (hence name) and handles negative eigenvalues differently.
eigenvals.wcmdscale
and
stressplot.wcmdscale
are some specific methods. Other
multidimensional scaling methods are monoMDS
, and
isoMDS
and sammon
in package
MASS.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## Correspondence analysis as a weighted principal coordinates
## analysis of Euclidean distances of Chi-square transformed data
data(dune)
rs <- rowSums(dune)/sum(dune)
d <- dist(decostand(dune, "chi"))
ord <- wcmdscale(d, w = rs, eig = TRUE)
## Ordinary CA
ca <- cca(dune)
## Eigevalues are numerically similar
ca$CA$eig - ord$eig
## Configurations are similar when site scores are scaled by
## eigenvalues in CA
procrustes(ord, ca, choices=1:19, scaling = 1)
plot(procrustes(ord, ca, choices=1:2, scaling=1))
## Reconstruction of non-Euclidean distances with negative eigenvalues
d <- vegdist(dune)
ord <- wcmdscale(d, eig = TRUE)
## Only positive eigenvalues:
cor(d, dist(ord$points))
## Correction with negative eigenvalues:
cor(d, sqrt(dist(ord$points)^2 - dist(ord$negaxes)^2))
|
Loading required package: permute
Loading required package: lattice
This is vegan 2.4-3
CA1 CA2 CA3 CA4 CA5
1.110223e-16 -6.661338e-16 -6.661338e-16 8.326673e-17 2.498002e-16
CA6 CA7 CA8 CA9 CA10
1.249001e-16 -1.249001e-16 -1.249001e-16 6.938894e-17 4.857226e-17
CA11 CA12 CA13 CA14 CA15
1.179612e-16 -2.081668e-17 -1.387779e-17 5.898060e-17 -1.040834e-17
CA16 CA17 CA18 CA19
1.734723e-18 1.908196e-17 -4.683753e-17 2.385245e-17
Call:
procrustes(X = ord, Y = ca, choices = 1:19, scaling = 1)
Procrustes sum of squares:
-7.105e-14
[1] 0.9975185
[1] 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.