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

CODED BINNED

Name:
    CODED BINNED (LET)
Type:
    Let Subcommand
Purpose:
    Bin (i.e., create a frequency table) a response variable and create an additional variable that specifies to which bin each observation belongs.
Description:
    This command is similar to the BINNED command. However, it creates an additional "coded" variable that identifies the bin number of each observation.

    Binning a data variable means to divide it into classes and compute the frequency for each class. This is the numerical equivalent of a histogram. Creating the classes for the binning uses the same rules as the histogram. That is

    1. The class width is 0.3 times the sample standard deviation.

    2. The lower limit is the sample mean minus 6 times the standard deviation.

    3. The upper limit is the sample mean plus 6 times the standard deviation.

    As with the histogram, you can use the CLASS WIDTH, CLASS LOWER, and CLASS UPPER commands to override these defaults. Also, you can specify that relative frequencies rather than counts be computed. The command SET RELATIVE HISTOGRAM <AREA/PERCENT> can be used to specify whether relative frequencies are computed so that the area sums to 1 or so that frequencies sum to 1. The first option, which is the default, is useful for when using the relative binning as an estimate of a probability distribution. The second option is useful when you want to see what percentage of the data falls in a given class.

Syntax 1:
    LET <y2> <x2> <ycoded> = CODED BINNED <y>
                            <SUBSET/EXCEPT/FOR qualification>
    where <y> is the response variable;
                <y2> is a variable where the computed counts (or frequencies) are stored;
                <x2> is a variable where the computed bin mid-points are stored;
                <ycoded> is a variable where the bin-id's are stored;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.
Syntax 2:
    LET <y2> <x2> <ycoded> = CODED RELATIVE BINNED <y>
                            <SUBSET/EXCEPT/FOR qualification>
    where <y> is the response variable;
                <y2> is a variable where the computed counts (or frequencies) are stored;
                <x2> is a variable where the computed bin mid-points are stored;
                <ycoded> is a variable where the bin-id's are stored;
    and where the <SUBSET/EXCEPT/FOR qualification> is optional.

    This syntax generates relative frequencies instead of counts when binning the data.

Examples:
    LET Y2 X YCODE = BINNED Y
    LET Y2 X YCODE = BINNED Y SUBSET TAG > 2
    LET Y2 X YCODE = RELATIVE BINNED Y
Default:
    None
Synonyms:
    CODED BINNED is a synonym for BINNED CODED.
    RELATIVE CODED BINNED is a synonym for CODED RELATIVE BINNED.
Related Commands: Applications:
    Data Analysis
Implementation Date:
    2012/12
Program:
     
    let y = norm rand numb for i = 1 1 50
    .
    let y2 x2 ycoded = coded binned y
    let ntemp = size y2
    let xseq = sequence 1 1 ntemp
    .
    set write decimals 3
    print x2 y2  xseq
    print y ycoded
        
    The following output is generated
    ---------------------------------------------
                 X2             Y2           XSEQ
    ---------------------------------------------
             -2.037          1.000          1.000
             -1.823          0.000          2.000
             -1.610          0.000          3.000
             -1.396          0.000          4.000
             -1.182          0.000          5.000
             -0.969          4.000          6.000
             -0.755          3.000          7.000
             -0.542          8.000          8.000
             -0.328          5.000          9.000
             -0.115          4.000         10.000
              0.098          5.000         11.000
              0.312          8.000         12.000
              0.525          5.000         13.000
              0.739          2.000         14.000
              0.952          1.000         15.000
              1.166          1.000         16.000
              1.380          1.000         17.000
              1.593          2.000         18.000
     
     
    ------------------------------
                  Y         YCODED
    ------------------------------
             -1.073          6.000
              0.573         13.000
             -0.873          6.000
              0.233         12.000
             -0.455          8.000
             -0.525          8.000
             -0.705          7.000
              0.032         11.000
              1.190         16.000
              0.269         12.000
             -0.149         10.000
             -0.196         10.000
             -0.243          9.000
             -0.840          7.000
             -0.103         10.000
              0.418         12.000
              0.263         12.000
              0.898         15.000
              0.034         11.000
              1.587         18.000
              0.388         12.000
             -0.469          8.000
             -1.062          6.000
             -0.027         10.000
             -0.463          8.000
              0.591         13.000
             -0.506          8.000
             -0.359          9.000
              0.498         13.000
              0.242         12.000
              0.793         14.000
             -0.479          8.000
              0.360         12.000
              1.488         18.000
             -0.358          9.000
              0.394         12.000
             -0.892          6.000
              0.117         11.000
             -0.440          8.000
              1.376         17.000
              0.463         13.000
             -0.281          9.000
             -2.015          1.000
             -0.352          9.000
              0.842         14.000
              0.030         11.000
             -0.580          8.000
              0.100         11.000
             -0.766          7.000
              0.622         13.000
     
        

Date created: 01/07/2013
Last updated: 01/13/2013
Please email comments on this WWW page to alan.heckert@nist.gov.