Learn R Programming

seriation (version 1.5.6)

uniscale: Fit an Unidimensional Scaling for a Seriation Order

Description

Fits an (approximate) unidimensional scaling configuration given an order.

Usage

uniscale(d, order, accept_reorder = FALSE, warn = TRUE, ...)

MDS_stress(d, order, refit = TRUE, warn = FALSE)

get_config(x, dim = 1L, ...)

plot_config(x, main, pch = 19, labels = TRUE, pos = 1, cex = 1, ...)

Value

A vector with the fitted configuration.

Arguments

d

a dissimilarity matrix.

order

a precomputed permutation (configuration) order.

accept_reorder

logical; accept a configuration that does not preserve the requested order. If FALSE, the initial configuration stored in order or, an equally spaced configuration is returned.

warn

logical; produce a warning if the 1D MDS fit does not preserve the given order.

...

additional arguments are passed on to the seriation method.

refit

logical; forces to refit a minimum-stress MDS configuration, even if order contains a configuration.

x

a scaling returned by uniscale() or a ser_permutation with a configuration attribute.

dim

The dimension if x is a ser_permutation object.

main

main plot label

pch

print character

labels

add the object names to the plot

pos

label position for 2D plot (see text()).

cex

label expansion factor.

Author

Michael Hahsler with code from Patrick Mair (from smacof::uniscale()).

Details

This implementation uses the method describes in Maier and De Leeuw (2015) to calculate the minimum stress configuration for a given (seriation) order by performing a 1D MDS fit. If the 1D MDS fit does not preserve the given order perfectly, then a warning is produced indicating for how many positions order could not be preserved. The seriation method which is consistent to uniscale is "MDS_smacof" which needs to be registered with register_smacof().

The code is similar to smacof::uniscale() (de Leeuw, 2090), but scales to larger datasets since it only uses the permutation given by order.

MDS_stress() calculates the normalized stress of a configuration given by a seriation order. If the order does not contain a configuration, then a minimum-stress configuration if calculates for the given order.

All distances are first normalized to an average distance of close to 1 using \(d_{ij} \frac{\sqrt{n(n-1)/2}}{\sqrt{\sum_{i<j}{d_{ij}}^2}}\).

Some seriation methods produce a MDS configuration (a 1D or 2D embedding). get_config() retrieved the configuration attribute from the ser_permutation_vector. NULL is returned if the seriation did not produce a configuration.

plot_config() plots 1D and 2D configurations. ... is passed on to plot.default and accepts col, labels, etc.

References

Mair P., De Leeuw J. (2015). Unidimensional scaling. In Wiley StatsRef: Statistics Reference Online, Wiley, New York. tools:::Rd_expr_doi("10.1002/9781118445112.stat06462.pub2")

Jan de Leeuw, Patrick Mair (2009). Multidimensional Scaling Using Majorization: SMACOF in R. Journal of Statistical Software, 31(3), 1-30. tools:::Rd_expr_doi("10.18637/jss.v031.i03")

See Also

register_smacof()

Examples

Run this code
data(SupremeCourt)
d <- as.dist(SupremeCourt)
d

# embedding-based methods return "configuration" attribute
# plot_config visualizes the configuration
o <- seriate(d, method = "sammon")
get_order(o)
plot_config(o)

# the configuration (Note: objects are in the original order in d)
get_config(o)

# angle methods return a 2D configuration
o <- seriate(d, method = "MDS_angle")
get_order(o)
get_config(o)
plot_config(o, )


# calculate a configuration for a seriation method that does not
# create a configuration
o <- seriate(d, method = "ARSA")
get_order(o)
get_config(o)

# find the minimum-stress configuration for the ARSA order
sc <- uniscale(d, o)
sc

plot_config(sc)

Run the code above in your browser using DataLab