sumscal {lazy.mds}R Documentation

SUMSCAL

Description

SUMSCAL

Usage

sumscal(B, nr = 2, lmax = 50, eps = 1e-07, print = 2, estm = 0,
  Xall = NULL)

Arguments

B

Input scalar product array

nr

# of dimensions

lmax

max # of iterations

eps

convergence criterion for B

print

= 1 to print result

estm

= 1 to subtract column mean from X when Xall is given.

Xall

An Array of X_k's, or NULL

Details

Let B_k, k=1,2, ... , nG, be the scalar product matrices calculated from the distance matrices, D_k, as

B_k = -2 J D_k^2 J

where J is the column centering operator.
This program find those Xc and diagonal W_k matrices that minimize

RSS = tr( (B_k - Xc diag(W_k)^2 Xc')' (B_k - Xc diag(W_k)^2 Xc') ) .


Note that, if X_k can be expressed as\

X_k = Xc diag(W_k) T_k

we have

B_k == X_k X_k' = Xc diag(W_k)^2 Xc'

Therefore, given nG X_k matrices, we may first calculate B_k matrices,
find Xc and W_k matrices by SUMSCAL, and then find T_k matrices.

When X is present, it has priority over B.

Xc matrix will be normalized so that diag(t(Xc)

Value

A list of
X=Xc, W, T, rmseB, rmseX

References

De Leeuw, Jan, and Pruzansky, Sandra (1978) A New Computational Method to Fit the Weighted Euclidean Distance Model. Psychometrika, v43 n4 p479-9

Examples

set.seed(1701)
# generate O from X and W
X <- matrix( c( 0,4, 0,0, 3,0, 3,4, 1.5,2 ), ,2, byrow=1 )
dimnames(X) <- list(paste("s",1:nrow(X),sep=""), paste("d",1:ncol(X),sep=""))
X <- standard( X, center=1 )
W <- matrix( c( 1,1, 2,1, 1,2 ),,2, byrow=1 )
rownames(W) <- paste("sbj",1:nrow(W),sep=""); colnames(W) <- colnames(X)
resgen <- gendatamds( X=X, W=W, stderror=0.05, print=2 )
O <- vechinv(resgen$vO, nodiag=1, array=1)  # This is n x n x nG.
# double center O
n <- nrow(X); nG <- nrow(W)
J <- diag(n)-(1/n)*matrix(1,n,1)%*%matrix(1,1,n)
B <- O
for( k in 1:nG ){
 B[,,k] <- -0.5*J%*%O[,,k]^2%*%J
}
Print(O,B, fmt=".2")

res1 <- indscal( B, nr=2, print=1 )
res2 <- sumscal( B, nr=2, print=1 )

[Package lazy.mds version 0.1.2 Index]