indscal {lazy.mds}R Documentation

INDSCAL A Sollution to the Weighted Eucledian Distance Model

Description

INDSCAL A Sollution to the Weighted Eucledian Distance Model

Usage

indscal(
  B,
  ndim = 2,
  maxiter = 500,
  eps = 1e-06,
  print = 2,
  estX = 1,
  X = NULL,
  W = NULL,
  estm = 0,
  estpsi = 0,
  init = 2,
  Xall = NULL,
  SQUAREM = 3,
  nSQUAREM = 1,
  minalpha = -999,
  maxalpha = -1,
  bof_value = -9999,
  always = 1,
  reset1 = 1,
  reset2 = 2
)

Arguments

B

Input scalar product array

ndim

# of dimensions

maxiter

max # of iterations

eps

convergence criterion for B

print

= 1 to print result

estX

= 0 to skip the estimation of X

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.

estpsi

= 0 to set all psy equal to 0 (default)
= 1 to estimate unrestricted psi for each group
= 2 to estimate unrestricted psi common to all groups
= 3 to estimate hs psi for each group
= 4 to estimate common hs psi

init

= 1 to use cmds of mean Bs, 2 to use SUMSCAL

Xall

An Array of X_k's, or NULL

SQUAREM

= 3 : See the help of iSQUAREM in lazy.accel package.

nSQUAREM

>= 1 # of iterations a which SQUAREM begins.

minalpha

= -999 : See the help of iSQUAREM in lazy.accel package.

maxalpha

= -1 : See the help of iSQUAREM in lazy.accel package.

bof_value

= -9999: See the help of iSQUAREM in lazy.accel package.

always

= 1 : See the help of iSQUAREM in lazy.accel package.

reset1

= 0 : See the help of iSQUAREM in lazy.accel package.

reset2

= 1 : See the help of iSQUAREM in lazy.accel package.

Details

Given B_k, k=1,2, ... , nG, this program find those Xc and diagonal W_k matrices that minimize

RSS = sum_k ssq( B_k - Xl diag(W_k)^2 Xr' - diag(Psi_k) )


When B_k matrices are symmetric, upon convergence,
Xl=Xr and it will be reffered to as Xc.

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.
Note that, if the D_k matrices above were calculated from the X_k matrices which can be expressed as

X_k = Xc diag(W_k) T_k + Error

we have

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

Therefore, given nG X_k matrices, we may find Xc, W_k and T_k matrices by INDSCAL by first calculating the Euclidean distance matrices from X_k and then double centering them to get B_k matrices. and finally applying INDSCAL to those B_k matrices to obtain Xc and W_k matrices.
Given Xc and W_k matrices, T_k matrices can be found by orthogonal Procrustes rotation.


When X_k matrices are present as array Xall, they have priority over B.
That is, B_k matries will be calculated from Xall array/

Xc matrix will be normalized so that diag(t(Xc)%*%Xc) = n I and the columns will be sorted according to the magnitude of diag(t(W)%*%W).

Innsted of W, W^2 is used as the paramter during the course of iteration.

Set estpsi >0 when fitting the PARAFAC model to the dispersion/correlation matrices.

Value

A list of
Xc, W, T, Psi, rmseB, rmseBg, 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( -1,1, 0,1, 1,1,  -1,0, 0,0, 1,0, -1,-1, 0,-1, 1,-1  )
, ,2, byrow=1 )
dimnames(X) <- list(paste("s",1:nrow(X),sep="")
, paste("d",1:ncol(X),sep=""))
X <- standard( X )
W <- matrix( c( 1,1, 2,1, 1,1.5 ),,2, byrow=1 )
rownames(W) <- paste("sbj",1:nrow(W),sep=""); colnames(W) <- colnames(X)
resgen <- gendatamds( X=X, W=W^2, stderror=0.5 )
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, fmt=".2")

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






[Package lazy.mds version 0.1.4 Index]