gendatamds {lazy.mds} R Documentation

## Generation of Distance Matrices with Error

### Description

Generation of Distance Matrices with Error

### Usage

```gendatamds(n, nG = 1, ndim = 2, stderror = 0.2, X = NULL, W = NULL,
print = 0)
```

### Arguments

 `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

### Details

When X is NULL a n x ndim matrix will be generated using rnorm.
When W is NULL a nG x ndim matrix will be generated using runif and normalized so that diag(t(W)\%*\%W)=I.

Let D_k be the weighted Euclidean distance calculated from X and W[k,]. The O_k will be calculated as

O_k = D_k + stderror*var(vech(D_k))

### Value

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

### Examples

```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, stderror=0.2 )
O2=vechinv(resgen2\$vO, nodiag=1, array=1)  # This is n x n x nG.
```

[Package lazy.mds version 0.1.2 Index]