MSDST
Computes distances in a multidimensional scaling model.
Required Arguments
CFL — NSTIM by NDIM matrix containing the stimulus configuration. (Input)
NSUB — Number of subjects. (Input)
DIST — Vector of length nv * NSUB, where nv = NSTIM * (NSTIM ‑ 1)/2 if IFORM = 0, and nv = NSTIM * NSTIM otherwise. (Output)
DIST may be treated as NSUB distance matrices. Storage in DIST is such that the elements of each column of a subject’s distance matrix are adjacent. Each column in the matrix is immediately followed by the elements in the next column. If IFORM = 0, then only the elements in each column above the diagonal are stored. Otherwise, all elements are stored.
Optional Arguments
NSTIM — Number of stimuli. (Input)
Default: NSTIM = size (CFL,1).
NDIM — Number of dimensions in the model. (Input)
Default: NDIM = size (CFL,2).
LDCFL — Leading dimension of CFL exactly as specified in the dimension statement in the calling program. (Input)
Default: LDCFL = size (CFL,1).
IMOD — Vector of length 3 describing the weighting to be used. (Input)
Default: IMOD = 0.
IMOD |
Weight |
1 |
Not used. Reserved for other scaling subroutines. |
2 |
Subject weights (in W). |
3 |
Stimulus weights (in WS). |
If IMOD(i) is zero, then the i‑th set of weights is not used. Otherwise, the weights are used. For the Euclidean model, set IMOD(2) = IMOD(3) = 0. For the individual differences model, IMOD(2) should not be zero. For the stimulus weighted individual differences model, both IMOD(2) and IMOD(3) are not zero.
IFORM — Form option. (Input)
If IFORM = 0, the computed distances are stored as the upper triangle of square matrices stored columnwise without the diagonal elements. Otherwise, the distances are stored as square matrices and include the diagonal elements. See argument DIST.
Default: IFORM = 0.
ITRANS — Transformation option. (Input)
ITRANS determines the output returned in DIST.
Default: ITRANS = 0.
ITRANS |
Output in DIST |
0 |
Squared distances |
1 |
Distances |
2 |
Log of the distances |
W — NSUB by NDIM matrix of individual weights. (Input)
If IMOD(2) is zero, then W is not referenced and can be a 1 × 1 array.
Default: W is a 1x1 array and not used.
LDW — Leading dimension of W exactly as specified in the dimension statement in the calling program. (Input)
Default: LDW =size(W,1).
WS — NSTIM by NDIM matrix of stimulus weights. (Input)
If IMOD(3) is zero, then W is not referenced and can be a 1 × 1 array.
Default: WS is a 1x1 array and not used.
LDWS — Leading dimension of WS exactly as specified in the dimension statement in the calling program. (Input)
Default: LDWS =size(WS,1)
FORTRAN 90 Interface
Generic: CALL MSDST (CFL, NSUB, DIST [, …])
Specific: The specific interface names are S_MSDST and D_MSDST.
FORTRAN 77 Interface
Single: CALL MSDST (NSTIM, NDIM, CFL, LDCFL, NSUB, IMOD, IFORM, ITRANS, W, LDW, WS, LDWS, DIST)
Double: The double precision name is DMSDST.
Description
Routine MSDST computes squared distances, distances, or log distances for various metrics in multidimensional scaling. The “distances” are computed and stored as either square matrices or as upper triangular symmetric matrices stored columnwise without the diagonal. In both cases, the distances are output in a vector of the required length. The terminology and metrics used here are the same as those used in the ALSCAL program of Takane, Young, De Leeuw (1977).
Suppose that there are q stimuli, m subjects, and d dimensions. Let λik denote the location of the i‑th stimulus in the k‑th dimension. If wik denotes the weight of the i‑th subject on the k‑th dimension (matrix W) and piik denotes the weight for the i‑th stimulus on the k‑th dimension (matrix WS), then the distance models computed are the same as the distance models in MSIDV. They are given by:
Euclidean Model
Individual Differences Model
Stimulus‑Weighted Model
Stimulus‑Weighted Individual Differences Model
where δijm is the distance between the i‑th and j‑th stimuli on the m‑th subject.
Example
The following small example illustrates the distance computations in symmetric matrices. The data are fictional.
USE MSDST_INT
USE UMACH_INT
IMPLICIT NONE
INTEGER IFORM, ITRANS, LDCFL, LDW, LDWS, NDIM, NSTIM, NSUB
PARAMETER (LDCFL=4, LDW=2, LDWS=4, NDIM=2, NSTIM=4, NSUB=2)
!
INTEGER IMOD(3), NOUT
REAL CFL(NSTIM,NDIM), DIST(12), W(NSUB,NDIM), WS(1,1)
!
DATA IMOD/0, 1, 0/
!
DATA CFL/1.0, -1.0, 1.0, -1.0, &
1.0, 1.0, -1.0, -1.0/
!
DATA W/1.0, 2.0, 1.0, 2.0/
!
CALL MSDST (CFL, NSUB, DIST, IMOD=IMOD, W=W)
!
CALL UMACH (2, NOUT)
WRITE (NOUT,*) DIST
END
Output
4.00000 4.00000 8.00000 8.00000 4.00000 4.00000 8.00000
8.00000 16.0000 16.0000 8.00000 8.00000