Programmer Guide/Command Reference/EVAL/dist: Difference between revisions
From STX Wiki
< Programmer Guide | Command Reference | EVAL
Jump to navigationJump to search
No edit summary |
No edit summary |
||
Line 39: | Line 39: | ||
|''flag''=1 ||-> ''d''[i,j] = dist(''x''[*,i], ''x[*,j]'') ||, with: i,j = 0 .. <code>ncol(''x'')</code> | |''flag''=1 ||-> ''d''[i,j] = dist(''x''[*,i], ''x[*,j]'') ||, with: i,j = 0 .. <code>ncol(''x'')</code> | ||
|} | |} | ||
---- | |||
;See also: [[Programmer_Guide/Command_Reference/EVAL/var|var]], [[Programmer_Guide/Command_Reference/EVAL/corr|corr]] | ;See also: [[Programmer_Guide/Command_Reference/EVAL/var|var]], [[Programmer_Guide/Command_Reference/EVAL/corr|corr]] | ||
[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]] | [[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]] |
Revision as of 10:58, 20 April 2011
Compute the variance, covariance or covariance-matrix.
- Usage 1
dist(xscalar, yscalar)
dist(xvector, yvector)
- Result 1
- The euclidan distance dscalar of x and y. The two arguments must be scalars or vectors with the same length.
- Usage 2
dist(xvector)
dist(xmatrix)
- Result 2
- The matrix d with the euclidian distances of all elements or row vectors of x. The result is a matrix with
nrow(x)
rows and columns.
xvector -> d[i,j] = dist(x[i], x[j]) xmatrix -> d[i,j] = dist(x[i,*], x[j,*]) with: i,j = 0 .. ncol(x)
- Usage 3
dist(xvector, yscalar)
dist(xmatrix, yvector)
- Result 3
- The vector d with the euclidian distances of all elements or row vectors of x to y. The result is a vector with
nrow(x)
rows and columns.
xvector,yscalar -> d[i] = dist(x[i], y) xmatrix,yvector -> d[i,j] = dist(x[i,*], y) ( ncol(x)
must be equal tonrow(y)
!)with: i = 0 .. ncol(x)
- Usage 4
dist(xmatrix, flag)
- Result 4
- The matrix d with the euclidian distances of the row vectors (flag=0) or column vectors (flag=1) or x.
flag=0 -> d[i,j] = dist(x[i,*], x[j,*]) , with: i,j = 0 .. nrow(x)
flag=1 -> d[i,j] = dist(x[*,i], x[*,j]) , with: i,j = 0 .. ncol(x)