gendatamds {lazy.mds} | R Documentation |
This function calculates the weighted Euclidean distance as:
d_ijk = sqrt( sum_a w_ka (x_ia - x_ia)^2 )
Note that W
is NOT squared above.
gendatamds(n, nG = 1, ndim = 2, stderror = 0.2, X = NULL, W = NULL, print = 0)
n |
# of stimuli |
nG |
# of subjects |
ndim |
# of dimensions |
stderror |
The standard deviation of error to be added. |
X |
n x ndim Stimulus Configuration Matrix or NULL. |
W |
nG x ndim Subject Weight Matrix or NULL |
print |
= 1 to print the result |
A list of
vO: n*(n-1)/2 x nG array consisting of O_k, k=1,2, ..., nG
vD: n*(n-1)/2 x nG array consisting of O_k, k=1,2, ..., nG
X: n x ndim configuration matrix
W: nG x ndim matrix of subject weights
stderror: standard deviation of the addtive error
set.seed(1701) n <- 15; nG <- 5; ndim <- 2 resgen1 <- gendatamds( n, nG=3, ndim=2, stderror=0.2 ) O <- vechinv(resgen1$vO, nodiag=1, array=1) # This is n x n x nG. 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="")) W <- matrix( c( 1,1, 2,1, 1,2 ),,2, byrow=1 ) dimnames(W) <- list(paste("w",1:nrow(W),sep=""),paste("d",1:ncol(W),sep="")) resgen2 <- gendatamds( X=X, W=W^2, stderror=0.2 ) O2 <- vechinv(resgen2$vO, nodiag=1, array=1) # This is n x n x nG.