histogram_discrete


histogram_discrete, an Octave code which creates a histogram of discrete data.

The motivation of this study was to explore whether a histogram could be made without artificially imposing bins; instead, the original data would be kept and handled directly.

An attempt was made to come up with a sensible formulation of the probability density function (PDF) for data in the range [X_MIN,X_MAX]. Instead of what amounts to a Dirac delta function, or a discrete bin function, a piecewise linear function was devised that tried to emulate the distribution of probability density along the interval. A corresponding piecewise quadratic cumulative density function (CDF) was also constructed.

Because we don't use bins, we can plot the PDF and CDF at any resolution we like. When we do so, the CDF looks reasonable, but the PDF does not look so good; a particularly unpleasant example occurs for the Gaussian test. Now we see that binning has the advantage of smoothing out the PDF data, whereas our piecewise linear function is too jumpy. Presumably, one way to cure this would allow us to retain the piecewise linear PDF, while essentially binning the data dynamically, according to the resolution of the requested plot. This, of course, is work to be pursued in the vague future.

Licensing:

The computer code and data files described and made available on this web page are distributed under the MIT license

Languages:

histogram_discrete is available in a MATLAB version. an Octave version.

Related Programs:

histogram_discrete_test

histogram_display, an Octave code which makes a bar plot of a set of data stored as columns in a file; the first column is the X values, and all the other columns are Y values to be shown as a stack of bars;

pwc_plot_1d, an Octave code which converts the definition of a piecewise constant (PWC) function of a 1D argument into plottable data.

Source Code:


Last revised on 12 June 2023.