MSSTN
Transforms dissimilarity/similarity matrices and replace missing values by estimates to obtain standardized dissimilarity matrices.
Required Arguments
NROW — Number of row stimuli in each dissimilarity/similarity matrix. (Input)
NCOL — Number of column stimuli in each dissimilarity/similarity matrix. (Input)
If IFORM = 0 or 1, NCOL must equal NROW, and the stimuli in the rows and columns must correspond to one another.
IFORM — Storage option indicating the storage mode for the input data in each column of X. (Input)
Array X contains NSUB columns, and each column of X contains a dissimilarity/similarity matrix stored as specified by option 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), …, (NROW ‑ 1, NROW) elements of the corresponding dissimilarity/similarity 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), …, (NROW, NROW) elements of the corresponding dissimilarity/similarity matrix. |
2 | Rectangular matrix in full storage mode. In this storage mode, the row and column stimuli input in X do not correspond to each other. Let m = NROW. Consecutive elements of each column of X contain the (1, m + 1), (2, m + 1), …, (NROW, m + 1), (1, m + 2), …, (NROW, m + 2), …, (NROW, m + NCOL) elements of the corresponding dissimilarity/similarity matrix. |
X — NSUB similarity or dissimilarity matrices in storage mode as determined by IFORM. (Input)
X must be dimensioned as:
DIMENSION X (LDX,NSUB)
where LDX ≥ NROW * NCOL in full storage mode and LDX ≥ NROW * (NROW ‑ 1)/2 in symmetric storage mode. See argument IFORM for the method of storage used for each storage mode. Negative elements of X, or elements equal to NaN (“not a number”) are presumed to be missing values and will be estimated as an appropriate average in MSSTN.
ICNVT — Option for converting from similarity to dissimilarity matrices. (Input)
ICNVT | Conversion |
---|
0 | No conversion performed. |
1 | Subtracting each similarity from the largest similarity in the strata (see ISTRAT). |
2 | Take the reciprocal of each similarity (elements of X equal to zero are assumed to be missing). |
ISTRAT — Option giving the level of stratification to be used. (Input)
If ISTRAT = 1, each dissimilarity/similarity matrix in X is considered to be in a different stratum. The data are said to be matrix conditional. If ISTRAT = 2, each column of each dissimilarity matrix is considered to be in a different stratum. (Thus, each column of array X contains NCOL strata.) For ISTRAT to be 2, IFORM must be 1 or 2. The data are said to be column conditional. If ISTRAT = 3, all of the dissimilarity/similarity matrices in X are considered to be in the same stratum. The data are said to be unconditional.
NCOM — Vector containing the number of nonmissing observations in each stratum. (Output)
The diagonal elements of each dissimilarity/similarity matrix are not counted.
ISTRAT | Length of NCOM |
---|
1 | NSUB |
2 | NSUB * NSTIM, where NSTIM = NROW when IFORM = 0 or 1, and NSTIM = NROW + NCOL when IFORM = 2 |
3 | 1 |
XOUT — Vector of length NV * NSUB containing the standardized dissimilarity matrices where NV = NROW * (NROW ‑ 1)/2 if IFORM = 0 and NV = NSTIM * NSTIM otherwise. (Output)
The value of NSTIM is as described in parameter NCOM. XOUT contains the standardized dissimilarity matrices in the same storage mode as X if IFORM = 0 or 1 and stored as square matrices when IFORM = 2. Missing values are replaced by an appropriate average dissimilarity and changed in sign. Scaling is performed as requested.
Optional Arguments
NSUB — Number of dissimilarity/similarity 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 | Scaling |
---|
0 | No scaling is performed. |
1 | The data in each stratum are scaled such that the sum of the squared dissimilarities equals the number of elements in the stratum. |
FORTRAN 90 Interface
Generic: CALL MSSTN (NROW, NCOL, IFORM, X, ICNVT, ISTRAT, NCOM, XOUT [, …])
Specific: The specific interface names are S_MSSTN and D_MSSTN.
FORTRAN 77 Interface
Single: CALL MSSTN (NROW, NCOL, NSUB, IFORM, X, LDX, ICNVT, ISTRAT, ISCALE, NCOM, XOUT)
Double: The double precision name is DMSSTN.
Description
Routine MSSTN standardizes dissimilarity/similarity data to be usable by other routines in the multidimensional scaling chapter. Routine MSSTN converts similarity to dissimilarity data, estimates missing values within specified strata (“conditionality groups”), scales the data, computes the number of nonmissing data elements within each stratum, and stores the data in a standard form.
The computations proceed as follows:
1. Routine MSSTN begins by expanding rectangular or symmetric storage‑form data into square storage mode (the form when IFORM = 1).
2. Missing values are replaced by the average nonmissing value within the stratum, or when there is only one stratum, the average within each matrix is used. If all elements in a stratum are missing and the stratum is a column of the dissimilarity/similarity matrix, then the average of the nonmissing elements in the matrix is used as the missing value estimate. (Missing values are estimated primarily for use in routines computing estimates via “double‑centering”, routines MSINIand MSDBL.) Missing values are denoted in the output by changing the signs of the estimated missing elements to be negative.
3. The data are converted to dissimilarity data from similarity data according to the method specified by the parameter ICNVT.
4. The data are scaled according to the method specified by the ISCALE parameter.
Comments
1. Workspace may be explicitly provided, if desired, by use of M2STN/DM2STN. The reference is:
CALL M2STN (NROW, NCOL, IFORM, NSUB, X, LDX, ICNVT, ISTRAT, ISCALE, NCOM, XOUT, NSTIM, XX, XMIS)
The additional arguments are as follows:
NSTIM — Integer scalar. NSTIM = NROW when IFORM = 0 or 1, and NSTIM = NROW + NCOL when IFORM = 2.
XX — Work vector of length NSTIM * NSTIM.
XMIS — Work vector of length NSTIM * NSTIM.
2. Informational errors
Type | Code | Description |
---|
3 | 1 | At least one column in column conditional data has all elements missing. |
4 | 2 | A dissimilarity matrix has every element missing. |
Example
The following example illustrates the use of MSSTN on similarity data that are converted to dissimilarity data with the ICNVT = 1 option. Standardization within each matrix is used. The input data is such that IFORM = 0. Since ICNVT = 1 and all elements of the input data are nonnegative, no missing values are estimated. The input data is given by the following two similarity matrices:
USE MSSTN_INT
USE WRIRN_INT
USE UMACH_INT
IMPLICIT NONE
INTEGER ICNVT, IFORM, ISTRAT, LDX, NCOL, NROW, NSUB
PARAMETER (ICNVT=1, IFORM=0, ISTRAT=1, LDX=10, NCOL=5, &
NROW=5, NSUB=2)
!
INTEGER I, J, K, N, NCOM(NSUB), NOUT
REAL X(LDX,NSUB), XOUT(NROW*(NROW-1))
!
DATA X/4.0, 0.0, 1.0, 3.0, 1.0, 0.0, 1.0, 3.0, 2.0, 4.0, 1.0, &
2.0, 1.0, 3.0, 2.0, 1.0, 1.0, 0.0, 3.0, 4.0/
!
CALL MSSTN (NROW, NCOL, IFORM, X, ICNVT, ISTRAT, &
NCOM, XOUT)
!
CALL WRIRN ('NCOM', NCOM, 1, NSUB, 1)
CALL UMACH (2, NOUT)
!
N = 1
DO 20 I=1, 2
WRITE (NOUT,99998) I
DO 10 J=1, 4
WRITE (NOUT,99999) (XOUT(K),K=N,N+J-1)
N = N + J
10 CONTINUE
20 CONTINUE
!
99998 FORMAT (///' Output matrix (in XOUT)', I2)
99999 FORMAT (1X, 4F8.3)
!
END
Output
NCOM
1 2
10 10
Output matrix (in XOUT) 1
0.000
1.569 1.177
0.392 1.177 1.569
1.177 0.392 0.784 0.000
Output matrix (in XOUT) 2
1.205
0.803 1.205
0.402 0.803 1.205
1.205 1.606 0.402 0.000