|
CODED BINNEDName:
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
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.
<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.
<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.
LET Y2 X YCODE = BINNED Y SUBSET TAG > 2 LET Y2 X YCODE = RELATIVE BINNED Y
RELATIVE CODED BINNED is a synonym for CODED RELATIVE BINNED.
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 ycodedThe 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 |