# eval.stress: Evaluates the Sammon stress of an embedding In spe: Stochastic Proximity Embedding

## Description

Given an N dimensional dataset embedded M dimensions, this function will evaluate the Sammon stress of the embedding, via probability sampling

## Usage

 1 2 3 eval.stress( x, coord, ndim = 0, edim = 0, nobs = 0, samplesize = 1e6) 

## Arguments

 x The embedded data in matrix form. If present in a data.frame it will be coerced to a matrix coord The input data in matrix form. If present in a data.frame it will be coerced to a matrix nobs The number of observations (rows of the input matrix should be the same as the rows of the embedding matrix) If it is not specified nobs will be taken as nrow(coord) ndim The number of input dimensions. If not specified it will be taken as ncol(coord) edim The number of dimensions to embed in. If not specified it will be taken as ncol(x) samplesize The number of iterations for probability sampling. For a dataset of 6070 observations there will be 6070x6069/2 pairwise distances. The default value gives a close approximation and runs fast. If you want a better approximation 1e7 is a good value. YMMV

## Details

The Sammon stress is given by

S = ∑_{i < j} \frac{ (d_{ij} - r_{ij} )^2 }{r_{ij}} / ∑_{i<j} r_{ij}

where d_{ij} is the Euclidean distance between two observations in the embedded data and r_{ij} is the relationship (in this case it is the Euclidean distance but could be a similarity value) between the two observations in the input data

## Value

Returns the value of the Sammon stress as a single number

## References

Stochastic Proximity Embedding, J. Comput. Chem., 2003, 24, 1215-1221