<BODY > <HR><center> <table border=1> <td> <A NAME="tex2html21" HREF="node1.html"><img height=36 width=36 alt="PREVIOUS" src="../../../icons/latex2html/previous.gif"></A></td> <td> <A NAME="tex2html27" HREF="axis.html"><img height=36 width=36 alt="UP" src="../../../icons/latex2html/up.gif"></A></td> <td> <A NAME="tex2html29" HREF="node3.html"><img height=36 width=36 alt="NEXT" src="../../../icons/latex2html/next.gif"></A></td> <td><a href="contents-node2.html"><img height=36 width=36 alt="CONTENTS" src="../../../icons/latex2html/toc.gif"></a></td> </table> </center> <HR> <!--End of Navigation Panel--> <H1><A NAME="SECTION00020000000000000000"> hist</A> </H1> <P> Another useful utility constructs histograms. These are frequency distributions for a single variable. For example, the course utility <B>normdist</B> generates a list of Gaussian distributed random numbers. Suppose you wanted to reconstruct a graph of this probability distribution, based on a sample that you generated. You would make a bar graph with the x-axis representing the random number and the y-axis representing a count (integer) as follows. First you would mark off a series of equally spaced intervals on the x-axis to represent the ``bins'' of the histogram. Then you would examine each number in your sample and tally a ``one'' for the bin that that number falls into. After processing all of the numbers in this way, each bin would contain the count of the number of values in your sample that fall in that bin. This is the ``frequency'' of the occurrence of numbers in that bin. A bar graph of these frequencies is a histogram. <P> To see one, try this example: <PRE> normdist | hist -g | axis | xplot Enter mean 0 Enter st dev 4 How many values do you want? 1000 Enter random number seed. 35 STOP </PRE> (In the dialog above, you type every other line. The computer gives the others.) The command line starts by running normdist, the course utility that generates the random numbers. The output is piped into <B>hist</B>, the course histogramming utility. The option <B>-g</B> tells <B>hist</B> to produce output in the axis style. This output is piped into the axis utility and finally into xplot to put it on your screen. The graph that emerges shows that about 280 of the 1000 values fall in the the central bin (the one around 0), and about 15 values fall in the leftmost bin. <P> The <B>hist</B> options are listed here: <PRE> * option -n specifies number of bins * * option -s specifies size of bin * * option -x specifies lower and upper limits of histogram * * option -g specifies output in form suitable for "graph" * * or "axis" * * if -g 1 we get a full bar for each bin * * if -g 2 the bars don't go down to the origin * * option -m specifies the line type for use with "axis" * </PRE> So you could make the bins line up with the tick marks with the command <PRE> normdist | hist -g -s 2 -x -20 20 | axis | xplot </PRE> <P> <HR><center> <table border=1> <td> <A NAME="tex2html21" HREF="node1.html"><img height=36 width=36 alt="PREVIOUS" src="../../../icons/latex2html/previous.gif"></A></td> <td> <A NAME="tex2html27" HREF="axis.html"><img height=36 width=36 alt="UP" src="../../../icons/latex2html/up.gif"></A></td> <td> <A NAME="tex2html29" HREF="node3.html"><img height=36 width=36 alt="NEXT" src="../../../icons/latex2html/next.gif"></A></td> <td><a href="contents-node2.html"><img height=36 width=36 alt="CONTENTS" src="../../../icons/latex2html/toc.gif"></a></td> </table> </center> <HR> <!--End of Navigation Panel--> <HR><P><ADDRESS> <I></I> </ADDRESS> </BODY>