MSDBL
Obtains normalized product‑moment (double centered) matrices from dissimilarity matrices.
Required Arguments
NSTIM — Number of stimuli in each dissimilarity matrix. (Input)
IFORM — Storage option for the data in each dissimilarity matrix. (Input) Each column of X contains one of the NSUB dissimilarity matrices in the storage mode specified by IFORM.
IFORM
Data Storage Mode
0
Symmetric storage mode without the diagonal elements. (Upper triangular matrix stored columnwise.) In this storage mode, consecutive elements of each column of X contain the (1, 2), (1, 3), (2, 3), (1, 4), (2, 4), (3, 4), , (NSTIM  1, NSTIM) elements of the corresponding dissimilarity matrix.
1
Square matrix in full storage mode. Consecutive elements of each column of X contain the (1, 1), (2, 1), (3, 1), , (NROW, 1), (1, 2), (2, 2), , (NSTIMNSTIM) elements of the corresponding dissimilarity matrix.
XNV by NSUB matrix containing the NSUB dissimilarity matrices, where NV = NSTIM * (NSTIM   1)/2 if IFORM = 0, and NV = NSTIM * NSTIM if IFORM = 1. (Input)
Missing values (NaN, “not a number”) are not allowed in X, but the position of a missing element may be indicated as a negative dissimilarity. Since MSDBL uses the absolute value of each element in X in the estimation procedure, the signs of elements in X have no effect. See Comments.
DISPNSTIM by NSTIM by NSUB array containing the NSUB dissimilarity matrices in full storage mode. (Output)
In DISP, missing value estimates are positive, and all elements represent the square of distances.
PNSTIM by NSTIM by NSUB array containing the standardized product‑moment matrices in full storage mode. (Output)
P contains NSUB matrices, each of size NSTIM by NSTIM. If DISP is not needed, DISP and P can occupy the same storage locations.
DSNSTIM by NSTIM array containing the sum of the NSUB matrices in P. (Output)
Optional Arguments
NSUB — Number of dissimilarity matrices. (Input)
Default: NSUB = size (X,2).
LDX — Leading dimension of X exactly as specified in the dimension statement in the calling program. (Input)
Default: LDX = size (X,1).
ISCALE — Scaling option. (Input)
Default: ISCALE = 1.
ISCALE
Type of Scaling
0
No scaling
1
Scaling within each matrix
2
Scaling over all matrices
Scaling is such that the Euclidean norm of the vector of scaled data is equal to the number of elements in vector.
LDDISP — Leading and second dimension of DISP exactly as specified in the dimension statement in the calling program. (Input)
Default: LDDISP = size (DISP,1).
LDP — Leading and second dimension of P exactly as specified in the dimension statement in the calling program. (Input)
Default: LDP = size (P,1).
LDDS — Leading dimension of DS exactly as specified in the dimension statement in the calling program. (Input)
Default: LDDS = size (DS,1).
FORTRAN 90 Interface
Generic: CALL MSDBL (NSTIM, IFORM, X, DISP, P, DS [])
Specific: The specific interface names are S_MSDBL and D_MSDBL.
FORTRAN 77 Interface
Single: CALL MSDBL (NSTIM, NSUB, IFORM, X, LDX, ISCALE, DISP, LDDISP, P, LDP, DS, LDDS)
Double: The double precision name is DMSDBL.
Description
Routine MSDBL computes product‑moment (double‑centered) matrices from input dissimilarity matrices. The product‑moment matrices output from MSDBL may be scaled either within each matrix, over all matrices input, or not at all.
The interest in product‑moment matrices can be explained as follows: Let Λ denote a configuration of points in an d‑dimensional Euclidean space with center at the origin. When the data is measured without error, the matrix P = ΛΛT can also be written as the “double‑centered” matrix (defined below) obtained from the matrix of squares of distances between the rows of
These distances are input, approximately, in the dissimilarities. Thus, an estimate for Λ can be obtained, approximately, by computing the double‑centered matrix P from the squared dissimilarities and then computing Λ from the scaled eigenvectors of P (such that P = ΛΛT).
The computation in MSDBL proceeds as follows:
1. Each input dissimilarity matrix is transformed into a square symmetric matrix of distances. Asymmetric matrices are made symmetric by averaging the matrix of dissimilarities with its transpose.
2. Estimates for the square of the distances,
are computed as the square of the estimated distances.
3. Let
denote the average squared distance in a matrix m of squared distances, let
denote the average of the i‑th row of estimated squared distances in matrix m and let
denote the average of the j‑th column. The m‑th product‑moment matrix is computed from the m‑th estimated squared distance matrix as
The resulting matrix is said to be double‑centered.
4. If the elements of Pm are to be scaled within matrix m, then the elements of Pm are divided by
where q = NSTIM so that q2 is the total number of elements in the matrix. If the elements of P are to be scaled over all matrices, then the elements of each matrix are divided by
where s = NSUB.
5. The matrix DS is computed as the sum over all subjects of the product‑moment matrices, Pm.
Comments
Routine MSSTN may be used to obtain the matrix X with missing values estimated and changed in sign so that all estimates of missing values are negative. Routine MSSTN will also convert similarities to dissimilarities. Unless a ratio distance measure is observed, the user will usually call MSSTN prior to calling MSDBL.
Example
The following example illustrates the use of MSDBL in computing product‑moment matrices for two input dissimilarity matrices. The input matrices are given as:
 
USE MSDBL_INT
USE WRRRN_INT
 
IMPLICIT NONE
INTEGER IFORM, LDDISP, LDDS, LDP, LDX, NSTIM, NSUB
PARAMETER (IFORM=0, LDDISP=5, LDDS=5, LDP=5, LDX=10, &
NSTIM=5, NSUB=2)
!
REAL DISP(LDDISP,LDDISP,NSUB), DS(LDDS,NSTIM), &
P(LDP,LDP,NSUB), X(LDX,NSUB)
!
DATA X/4.0, 1.0, 1.0, 3.0, 1.0, 2.0, 1.0, 3.0, 2.0, 4.0, 1.0, &
2.0, 1.0, 3.0, 2.0, 1.0, 1.0, 2.0, 3.0, 4.0/
!
CALL MSDBL (NSTIM, IFORM, X, DISP, P, DS)
!
CALL WRRRN ('The first matrix in DISP', DISP(1:,1:,1))
CALL WRRRN ('The second matrix in DISP', DISP(1:,1:,2))
CALL WRRRN ('The first matrix in P', P(1:,1:,1))
CALL WRRRN ('The second matrix in P', P(1:,1:,2))
CALL WRRRN ('DS', DS)
!
END
Output
 
The first matrix in DISP
1 2 3 4 5
1 0.00 16.00 1.00 9.00 1.00
2 16.00 0.00 1.00 1.00 9.00
3 1.00 1.00 0.00 4.00 4.00
4 9.00 1.00 4.00 0.00 16.00
5 1.00 9.00 4.00 16.00 0.00
The second matrix in DISP
1 2 3 4 5
1 0.00 1.00 4.00 9.00 1.00
2 1.00 0.00 1.00 4.00 4.00
3 4.00 1.00 0.00 1.00 9.00
4 9.00 4.00 1.00 0.00 16.00
5 1.00 4.00 9.00 16.00 0.00
The first matrix in P
1 2 3 4 5
1 1.110 -1.931 0.274 -0.487 1.034
2 -1.931 1.110 0.274 1.034 -0.487
3 0.274 0.274 -0.182 -0.182 -0.182
4 -0.487 1.034 -0.182 1.338 -1.703
5 1.034 -0.487 -0.182 -1.703 1.338
The second matrix in P
1 2 3 4 5
1 0.500 0.000 -0.500 -1.000 1.000
2 0.000 0.000 0.000 0.000 0.000
3 -0.500 0.000 0.500 1.000 -1.000
4 -1.000 0.000 1.000 2.000 -2.000
5 1.000 0.000 -1.000 -2.000 2.000
DS
1 2 3 4 5
1 0.805 -0.966 -0.113 -0.743 1.017
2 -0.966 0.555 0.137 0.517 -0.243
3 -0.113 0.137 0.159 0.409 -0.591
4 -0.743 0.517 0.409 1.669 -1.852
5 1.017 -0.243 -0.591 -1.852 1.669