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

GENERATE MATRIX

Name:
    GENERATE MATRIX (LET)
Type:
    Let Subcommand
Purpose:
    Given a list of k variables, generate a kxk matrix containing all the pairwise values of a specified statistic that requires exactly two response variables.
Description:
    This command can be useful for certain types of multivariate analysis. For example, it can be used to generate a dissimilarity or distance matrix for a cluster analysis.

    The specified statistic should require exactly two response variables to compute. Examples include correlation and covariances, various distance measures, differences of location or scale statistics, and so on. Statistics that require a single response variable or more than two response variables will return an error.

    A number of supported statistics that require two response variables have the second variable as a group-id variable. Although this command will not generate a syntax error for these cases, the resulting statistics will not be meaningful.

Syntax:
    LET <mat1> = GENERATE MATRIX <stat> <var1> ... <vark>
                            <SUBSET/EXCEPT/FOR qualification>
    where <stat> is one of Dataplot's supported statistics that requires exactly two response variable;
                <var1> ... <vark> is a list of previously defined variables;
                <mat1> is a matrix where the resulting matrix is saved;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Examples:
    LET C = GENERATE MATRIX CORRELATION X1 X2 X3 X4
    LET D = GENERATE MATRIX MANHATTAN DISTANCE Y1 Y2 Y3 Y4 Y5
Note:
    The columns of a matrix are accessible as variables by appending an index to the matrix name. For example, the 4x4 matrix C has columns C1, C2, C3, and C4. These columns can be operated on like any other Dataplot variable.
Note: Default:
    None
Synonyms:
    None
Related Commands: Applications:
    Multivariate Analyis
Implementation Date:
    2017/08
Program:
     
    set write decimals 3
    dimension 100 columns
    .
    skip 25
    read iris.dat y1 y2 y3 y4
    skip 0
    .
    . Step 2:   Generate the matrix
    .
    let m = generate matrix correlation y1 y2 y3 y4
    print m
    .
    let m = generate matrix euclidean distance y1 y2 y3 y4
    print m
    .
    let m = generate matrix difference of means y1 y2 y3 y4
    print m
        
    The following output is generated
            MATRIX CORR    --            4 ROWS
                           --            4 COLUMNS
    
     VARIABLES--CORR1          CORR2          CORR3          CORR4   
    
              1.000         -0.118          0.850          0.691
             -0.118          1.000         -0.472         -0.068
              0.850         -0.472          1.000          0.712
              0.691         -0.068          0.712          1.000
     
            MATRIX D       --            4 ROWS
                           --            4 COLUMNS
    
     VARIABLES--D1             D2             D3             D4      
    
              0.000         36.158         35.262         61.489
             36.158          0.000         30.185         29.383
             35.262         30.185          0.000         37.665
             61.489         29.383         37.665          0.000
     
            MATRIX DIFF    --            4 ROWS
                           --            4 COLUMNS
    
     VARIABLES--DIFF1          DIFF2          DIFF3          DIFF4   
    
              0.000          2.786          2.419          4.977
             -2.786          0.000         -0.367          2.191
             -2.419          0.367          0.000          2.559
             -4.977         -2.191         -2.559          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@nist.gov.