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

HAMMING DISTANCE

Name:
    HAMMING DISTANCE (LET)
Type:
    Let Subcommand
Purpose:
    Compute the Hamming distance between two variables.
Description:
    The Hamming distance is typically computed between two strings of equal length. In this case, the Hamming distance of the two strings is the count of the number of positions in the two strings that are different.

    This command takes two numeric variables of equal length. It returns the number of elements in the two variables that are different (i.e., X(1) is compared to Y(1), X(2) is compared to Y(2), and so on). Often these two variables will consist of a sequence of 1's and 0's, but this command is not restricted to that case.

    The STRING HAMMING DISTANCE can be used to compute the Hamming distance of two strings.

Syntax:
    LET <par> = HAMMING 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 Hamming distance is stored;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
    LET A = HAMMING DISTANCE Y1 Y2
    LET A = HAMMING 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/10
Program:
     
    LET Y1 = DATA 1 1 0 0
    LET Y2 = DATA 1 0 1 0
    LET DIST  = HAMMING DISTANCE Y1 Y2
    SET WRITE DECIMALS 0
    PRINT DIST
        
    The following output is returned
     PARAMETERS AND CONSTANTS--
    
         DIST    --         2
        

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@nist.gov.