naginterfaces.library.mv.multidimscal_​ordinal

naginterfaces.library.mv.multidimscal_ordinal(d, x, typ='T', itera=0, iopt=0, io_manager=None)[source]

multidimscal_ordinal performs non-metric (ordinal) multidimensional scaling.

For full information please refer to the NAG Library document for g03fc

https://www.nag.com/numeric/nl/nagdoc_28.5/flhtml/g03/g03fcf.html

Parameters
dfloat, array-like, shape

The lower triangle of the distance matrix stored packed by rows. That is must contain , for , for . If is missing then set ; for further comments on missing values see Further Comments.

xfloat, array-like, shape

The th row must contain an initial estimate of the coordinates for the th point, for . One method of computing these is to use multidimscal_metric().

typstr, length 1, optional

Indicates whether or is to be used as the criterion.

is used.

is used.

iteraint, optional

The maximum number of iterations in the optimization process.

A default value of is used.

A default value of (the default for opt.uncon_conjgrd_comp) is used.

ioptint, optional

Selects the options, other than the number of iterations, that control the optimization.

The tolerance is set to (Accuracy). All other values are set as described in Further Comments.

The tolerance is set to where . All other values are set as described in Further Comments.

No values are changed, therefore, the default values of opt.uncon_conjgrd_comp are used.

io_managerFileObjManager, optional

Manager for I/O in this routine.

Returns
xfloat, ndarray, shape

The th row contains coordinates for the th point, for .

stressfloat

The value of or at the final iteration.

dfitfloat, ndarray, shape

Auxiliary outputs.

If , the first elements contain the distances, , for the points returned in , the second set of contains the distances ordered by the input distances, , the third set of elements contains the monotonic distances, , ordered by the input distances, and the final set of elements contains fitted monotonic distances, , for the points in .

The corresponding to distances which are input as missing are set to zero.

If , the results are as above except that the squared distances are returned.

Each distance matrix is stored in lower triangular packed form in the same way as the input matrix .

Raises
NagValueError
(errno )

On entry, .

Constraint: or .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, all the elements of .

(errno )

The optimization has failed to converge in function iterations.

(errno )

The optimization cannot begin from the initial configuration.

(errno )

The optimization has failed.

Warns
NagAlgorithmicWarning
(errno )

The conditions for an acceptable solution have not been met but a lower point could not be found.

Notes

In the NAG Library the traditional C interface for this routine uses a different algorithmic base. Please contact NAG if you have any questions about compatibility.

For a set of objects, a distance or dissimilarity matrix can be calculated such that is a measure of how ‘far apart’ the objects and are. If variables have been recorded for each observation this measure may be based on Euclidean distance, , or some other calculation such as the number of variables for which . Alternatively, the distances may be the result of a subjective assessment. For a given distance matrix, multidimensional scaling produces a configuration of points in a chosen number of dimensions, , such that the distance between the points in some way best matches the distance matrix. For some distance measures, such as Euclidean distance, the size of distance is meaningful, for other measures of distance all that can be said is that one distance is greater or smaller than another. For the former metric scaling can be used, see multidimscal_metric(), for the latter, a non-metric scaling is more appropriate.

For non-metric multidimensional scaling, the criterion used to measure the closeness of the fitted distance matrix to the observed distance matrix is known as . is given by,

where is the Euclidean squared distance between points and and is the fitted distance obtained when is monotonically regressed on , that is is monotonic relative to and is obtained from with the smallest number of changes. So is a measure of by how much the set of points preserve the order of the distances in the original distance matrix. Non-metric multidimensional scaling seeks to find the set of points that minimize the .

An alternate measure is ,

in which the distances in are replaced by squared distances.

In order to perform a non-metric scaling, an initial configuration of points is required. This can be obtained from principal coordinate analysis, see multidimscal_metric(). Given an initial configuration, multidimscal_ordinal uses the optimization function opt.uncon_conjgrd_comp to find the configuration of points that minimizes or . The function opt.uncon_conjgrd_comp uses a conjugate gradient algorithm. multidimscal_ordinal will find an optimum that may only be a local optimum, to be more sure of finding a global optimum several different initial configurations should be used; these can be obtained by randomly perturbing the original initial configuration using functions from submodule rand.

References

Chatfield, C and Collins, A J, 1980, Introduction to Multivariate Analysis, Chapman and Hall

Krzanowski, W J, 1990, Principles of Multivariate Analysis, Oxford University Press