indscal {lazy.mds}R Documentation

INDSCAL

Description

INDSCAL

Usage

indscal(B, nr = 2, lmax = 500, eps = 1e-06, print = 2, X = NULL,
  W = NULL, 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

X

The initial value of X: n x ndim

W

The initial value of W: nG x ndim

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 INDSCAL, and then find T_k matrices.

When Xall 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

J.D. Carroll & J.-J. Chang, (1970) Analysis of Individual Differences in Multidimensional scaling via an N-way generalization of "Eckart-Young" Decomposition. Psychometrika 35: 283-319.

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=2 )
res2 <- sumscal( B, nr=2, print=2 )
res12 <- indscal( B, nr=2, X=res2$X, W=res2$W, print=2 )

[Package lazy.mds version 0.1.2 Index]