HISTOGRAMDATA [PERCENT | DENSITY] [BINSIZE binsizeNumber] [BINS binsNumber] inputVector binNumbersVec binStartsVec binCentersVec frequenciesVec [cumFrequenciesVec [invCumFrequenciesVec]]

Computes, from the given input vector, the numbers that would be used to plot a histogram. It does not create the histogram. You can print the numbers as a table or write them to a file (see WRITE command), or use them in your program.

The data computed are:

  • BinNumbersVec: This is the list of histogram bin numbers. The first bin number is zero.

  • BinStartsVec: This is the list of the start values for each bin.

  • BinCentersVec: This is the list of the center points of each bin.

  • FrequenciesVec: This is the list of the number of samples in each bin.

  • CumFrequenciesVec: This is the list of cumulative number of samples for each bin. This is an optional argument and may be omitted.

  • InvCumFrequenciesVec: This is the list of the inverse cumulative number of samples for each bin. This is an optional argument, but if it is present, then the CumFrequenciesVec must precede it on the command line.

If the percent keyword is present, the FrequenciesVec will contain the number of samples in the bins as a percentage of the total number of samples and CumFrequenciesVec and InvCumFrequenciesVec will be the cumulative summations of those sample count percentages.

If the density keyword is present, the FrequenciesVec will represent the probability density, I.e., the bin frequencies divided by the total number of samples divided by the bin width; the CumFrequenciesVec and InvCumFrequenciesVec will contain the cumulative summations of the fractional bin frequencies, i.e., each bin's frequency count divided by the total number of samples.

If neither keyword is present, the FrequenciesVec will represent the number of samples in the bins and the CumFrequenciesVec and InvCumFrequenciesVec will contain the cumulative summations of the actual bin frequencies.

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 number. 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.

See also: HISTOGRAM, and HISTOGRAMPLOT

NORMAL 10000 50 20 A
HISTOGRAMDATA percent A binNumbers binStarts binCenters frequencies cumFrequencies
PRINT table binNumbers binStarts binCenters frequencies cumFrequencies
XYGRAPH bincenters frequencies cumFrequencies

The above program produced the following table:

binNumbers    	binStarts     	binCenters    	frequencies   	cumFrequencies	
0.0E00        	-30           	-25           	2.0E-02       	2.0E-02       	
1             	-20           	-15           	0.15          	0.17          	
2             	-10           	-5            	0.44          	0.61          	
3             	0.0E00        	5             	1.58          	2.19          	
4             	10            	15            	4.3           	6.49          	
5             	20            	25            	9.309999      	15.800001     	
6             	30            	35            	14.02         	29.820002     	
7             	40            	45            	19.789999     	49.610001     	
8             	50            	55            	18.790001     	68.400002     	
9             	60            	65            	16.02         	84.419998     	
10            	70            	75            	8.97          	93.389999     	
11            	80            	85            	4.38          	97.769997     	
12            	90            	95            	1.59          	99.360001     	
13            	100           	105           	0.51          	99.870003     	
14            	110           	115 0.13          	100  

And this graph:


If you want to move your data to Microsoft Excel and create a histogram in Excel worksheet, you can just use HISTOGRAMDATA and PRINT TABLE as above to produce a table. Then copy the table and paste it into Excel. Or you can use the EXEC command to open Excel and write the data to it as shown in Example 2 of the EXEC command documentation.