Prints a histogram to the Output Window. If there are multiple vectors in the argument list, each will be printed as a separate histogram, but all with the same range and bin size. To have Statistics101 scale each vector's histogram individually, use separate histogram statements.
If the percent keyword is present, the y-axis will represent 0-100%.
The binsize keyword sets the width of each histogram bin to the number that follows the keyword. The number specifying the bin size may be a variable. If it is a literal number, it may be any decimal number and may be in scientific notation.
To set the desired number of bins, use the bins keyword followed by the desired number, which may be a variable or a literal numer. The actual number of bins used may not be exactly the number specified because the program tries to choose bin sizes that are "easy" to read. If both the bins and binsize keywords are present, binsize is used and bins is ignored.
The yscale keyword is allowed for backward compatibility with Resampling Stats, but is ignored by Statistics101. If you use yscale, you must follow it with a literalNumber.
Note that the "bin start" value is included in the bin and the "bin end" value is excluded. That means that if the bin start is 1.0, then a value of 1.0 will be counted as being in that bin. If the bin end is 1.0, then a value of 1.0 will belong in the next bin.
NORMAL 1000 50 20 A HISTOGRAMPLOT A
The above program produced the following output on one run:
Bin Bin Cum Bin# Start Center Freq Freq A 0 -10.0 -5.0 5 5 X 1 0.0 5.0 14 19 XXX 2 10.0 15.0 42 61 XXXXXXXXX 3 20.0 25.0 101 162 XXXXXXXXXXXXXXXXXXXXXXX 4 30.0 35.0 167 329 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 5 40.0 45.0 191 520 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 6 50.0 55.0 180 700 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 7 60.0 65.0 143 843 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 8 70.0 75.0 98 941 XXXXXXXXXXXXXXXXXXXXXXX 9 80.0 85.0 38 979 XXXXXXXX 10 90.0 95.0 14 993 XXX 11 100.0 105.0 5 998 X 12 110.0 115.0 2 1,000 HISTOGRAMPLOT A B C
The above command will print three histograms, one for each vector, all with the same bin size, x-scale, and y-scale.
HISTOGRAMPLOT A HISTOGRAMPLOT B HISTOGRAMPLOT C
The above commands will print three histograms, each scaled to its own data.
An example using keywords is:
HISTOGRAMPLOT percent bins 10 A B C
This command says to output three histograms with frequencies expressed as percents and with approximately ten bins. All three histograms will have the same number of bins and the same maximum frequency value. In this case the maximum frequency value for all three will be 100.0, since a percentage is called for.
Here's an example using binsize. The program takes 10000 samples from a normal distribution that has a mean of 0 and a standard deviation of 5.
NORMAL 10000 0 5 data HISTOGRAMPLOT binsize 1 Data
Unlike bins, which is just a suggestion to the program, binsize is set to the exact value specified. So in this example, the binsize will be exactly one. To see the result, cut and paste it into Statistics101 and run it.