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

CANBERRA DISTANCE

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

      \( D = \sum_{i=1}^{n} {\frac{|X_{i} - Y_{i}|} {|X_{i}| + |Y_{i}|}} \)

    The Canberra distance is a weighted version of the Manhattan distance.

Syntax:
    LET <par> = CANBERRA 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 Canberra distance is stored;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
    LET A = CANBERRA DISTANCE Y1 Y2
    LET A = CANBERRA 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:
    2018/08
Program:
     
    SKIP 25
    READ IRIS.DAT Y1 TO Y4 X
    .
    LET DIST  = CANBERRA DISTANCE Y1 Y2
    SET WRITE DECIMALS 4
    TABULATE CANBERRA 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
    .
    TITLE Canberra Distance (IRIS.DAT)
    Y1LABEL Canberra Distance
    CANBERRA DISTANCE PLOT Y1 Y2 X
        
    The following output is returned
     
                Cross Tabulate CANBERRA DISTANCE
     
    (Response Variables: Y1       Y2      )
    ---------------------------------------------
           X          |   CANBERRA DISTAN
    ---------------------------------------------
             1.0000   |            9.4298
             2.0000   |           18.2034
             3.0000   |           18.8760
        

    plot generated by sample program

Privacy Policy/Security Notice
Disclaimer | FOIA

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

Date created: 10/16/2018
Last updated: 10/16/2018

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