Dataplot Vol 2 Vol 1

# EUCLIDEAN DISTANCE

Name:
EUCLIDEAN DISTANCE (LET)
Type:
Let Subcommand
Purpose:
Compute the Euclidean distance between two variables.
Description:
The Euclidean distance between two variabes X and Y is defined as

$$\mbox{d} = \sqrt{\sum_{i=1}^{n}{(X_{i} - Y_{i})^{2}}}$$

The Euclidean distance is the straight line distance between two points in Euclidean space.

Syntax:
LET <par> = EUCLIDEAN DISTANCE <y1> <y2>
<SUBSET/EXCEPT/FOR qualification>
where <y1> is the first response variable;
<y2> is the second response variable;
<par> is a parameter where the computed Euclidean distance is stored;
and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
LET A = EUCLIDEAN DISTANCE Y1 Y2
LET A = EUCLIDEAN DISTANCE Y1 Y2 SUBSET Y1 > 0 SUBSET Y2 > 0
Note:
Dataplot statistics can be used in a number of commands. For details, enter

This command performs the same function as the VECTOR DISTANCE command. The distinction is that EUCLIDEAN DISTANCE is implemented as a Statistics LET subcommand while VECTOR DISTANCE is implemented as a Mathematics LET subcommand. The Statistics LET subcommands work with the commands documented in HELP STATISTICS while the Mathematics LET subcommands do not.

Default:
None
Synonyms:
None
Related Commands:
 COSINE DISTANCE = Compute the cosine distance. MANHATTAN DISTANCE = Compute the Manhattan distance. MATRIX DISTANCE = Compute various distance metrics for a matrix.
Applications:
Mathematics
Implementation Date:
2017/03
Program:

SKIP 25
READ IRIS.DAT Y1 TO Y4 X
.
LET DIST  = EUCLIDEAN DISTANCE Y1 Y2
SET WRITE DECIMALS 4
TABULATE EUCLIDEAN DISTANCE Y1 Y2 X
.
XTIC OFFSET 0.2 0.2
X1LABEL GROUP ID
LET NDIST = UNIQUE X
XLIMITS 1 NDIST
MAJOR X1TIC MARK NUMBER NDIST
MINOR X1TIC MARK NUMBER 0
CHAR X
LINE BLANK
LABEL CASE ASIS
CASE ASIS
TITLE CASE ASIS
TITLE OFFSET 2
.
SET STATISTIC PLOT REFERENCE LINE AVERAGE
TITLE Euclidean Distance (IRIS.DAT)
Y1LABEL Euclidean Distance
EUCLIDEAN DISTANCE PLOT Y1 Y2 X

The following output is generated
            Cross Tabulate EUCLIDEAN DISTANCE

(Response Variables: Y1       Y2      )
---------------------------------------------
X          |   EUCLIDEAN DISTA
---------------------------------------------
1.0000   |           11.3097
2.0000   |           22.5989
3.0000   |           25.8606


NIST is an agency of the U.S. Commerce Department.

Date created: 07/10/2017
Last updated: 07/10/2017