SED navigation bar go to SED home page go to Dataplot home page go to NIST home page SED Home Page SED Staff SED Projects SED Products and Publications Search SED Pages
Dataplot Vol 2 Vol 1

MINKOWSKI DISTANCE

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

      \[ (\sum_{i=1}^{n}{|X_{i} - Y_{i}|^{p}})^{1/p} \]

    The case where p = 1 is equivalent to the Manhattan distance and the case where p = 2 is equivalent to the Euclidean distance.

    Although p can be any real value, it is typically set to a value between 1 and 2. For values of p less than 1, the formula above does not define a valid distance metric since the triange inequality is not satisfied.

    The value of p is specified by entering the command

      LET P = <value>

    before entering the MINKOWSKI DISTANCE command. If p is not specified, a default value of p = 1 will be used.

Syntax:
    LET <par> = MINKOWSKI 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 Minkowski distance is stored;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
    LET P = 1
    LET A = MINKOWSKI DISTANCE Y1 Y2
    LET A = MINKOWSKI DISTANCE Y1 Y2 SUBSET Y1 > 0 SUBSET Y2 > 0
Note:
    Dataplot statistics can be used in a number of commands. For details, enter

Default:
    None
Synonyms:
    None
Related Commands: Applications:
    Mathematics
Implementation Date:
    2017/08
Program 1:
     
    SKIP 25
    READ IRIS.DAT Y1 TO Y4 X
    LET P = 1.5
    .
    LET DIST  = MINKOWSKI DISTANCE Y1 Y2
    SET WRITE DECIMALS 4
    TABULATE MINKOWSKI DISTANCE Y1 Y2 X
        
                Cross Tabulate MINKOWSKI DISTANCE
     
    (Response Variables: Y1       Y2      )
    ---------------------------------------------
           X          |   MINKOWSKI DISTA
    ---------------------------------------------
             1.0000   |           21.5631
             2.0000   |           43.1725
             3.0000   |           49.3414
         
    .
    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
    .
    TITLE Minkowski Distance with P = 1.5 (IRIS.DAT)
    Y1LABEL Minkowski Distance
    MINKOWSKI DISTANCE PLOT Y1 Y2 X
        

    plot generated by sample program

Program 2:
     
    set write decimals 3
    dimension 100 columns
    .
    skip 25
    read iris.dat y1 y2 y3 y4
    skip 0
    .
    let p = 1.5
    let z = generate matrix minkowski distance y1 y2 y3 y4
    print z
        
    The following output is generated
     
            MATRIX Z       --            4 ROWS
                           --            4 COLUMNS
    
     VARIABLES--Z1             Z2             Z3             Z4      
    
              0.000          5.100          5.600          6.600
              5.100          0.000          4.300          4.000
              5.600          4.300          0.000          4.700
              6.600          4.000          4.700          0.000
        

Privacy Policy/Security Notice
Disclaimer | FOIA

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

Date created: 08/31/2017
Last updated: 08/31/2017

Please email comments on this WWW page to alan.heckert.gov.