This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.

# HistogramDistribution

 HistogramDistribution represents the probability distribution corresponding to a histogram of the data values . HistogramDistributionrepresents a multivariate histogram distribution based on data values . HistogramDistributionrepresents a histogram distribution with bins specified by bspec.
• The probability density function for HistogramDistribution for a value is given by where is the number of data points in bin , is the width of bin , are bin delimiters, and is the total number of data points.
• The width of each bin is computed according to the values , the width according to the , etc.
• The following bin specifications bpsec can be given:
 n use n bins  » {w} use bins of width w  » {min,max,w} use bins of width w from min to max  » {{b1,b2,...}} use bins  » Automatic determine bin widths automatically "name" use a named binning method  » fw apply fw to get an explicit bin specification {xspec,yspec,...} give different x, y, etc. specifications
• Possible named binning methods include:
 "FreedmanDiaconis" twice the interquartile range divided by the cube root of sample size "Knuth" balance likelihood and prior probability of a piecewise uniform model "Scott" asymptotically minimize the mean square error "Sturges" compute the number of bins based on the length of data "Wand" one-level recursive approximate Wand binning
• The probability density for value in a histogram distribution is a piecewise constant function.
Create a histogram distribution of univariate data:
Use the resulting distribution to perform analysis, including visualizing distribution functions:
Compute moments and quantiles:
Create a histogram distribution of bivariate data:
Visualize the PDF and CDF:
Compute covariance and general moments:
Create a histogram distribution of univariate data:
Use the resulting distribution to perform analysis, including visualizing distribution functions:
 Out[3]=
Compute moments and quantiles:
 Out[4]=
 Out[5]=

Create a histogram distribution of bivariate data:
Visualize the PDF and CDF:
 Out[3]=
Compute covariance and general moments:
 Out[4]//MatrixForm=
 Out[5]=
 Scope   (28)
Create a distribution from a histogram of some data:
Compute probabilities from the distribution:
Decrease the number of bins to decrease local sensitivity:
Increase the bin width to decrease local sensitivity:
Create distributions from histograms in higher dimensions:
Plot the univariate marginal PDFs:
Plot the bivariate marginal PDFs:
Estimate distribution functions:
Compute moments of the distribution:
Special moments:
General moments:
Quantile function:
Special quantile values:
Generate random numbers:
Compare with HistogramDistribution:
Compute probabilities and expectations:
Generating functions:
Estimate distribution functions for bivariate data:
Compute moments of a bivariate distribution:
Special moments:
General moments:
Generate random numbers:
Show the point distribution:
Having fewer bins yields a coarser approximation to the underlying distribution:
Generating functions:
Automatically compute the number of bins:
More data yields smaller bins:
Explicitly specify the number of bins to use:
Specify 5 and 50 bins, respectively:
Explicitly specify bin width:
Use bin widths 1. and 0.1:
Specify bin range and bin width:
Use bin widths of and respectively over the interval to :
Provide explicit bin delimiters:
Use different automatic binning methods:
Delimit bins on integer boundaries using a binning function:
Automatically compute the number of bins for bivariate data:
More data yields smaller bins:
Explicitly specify the number of bins to use:
Specify 5 and 10 bins in each dimension:
Explicitly specify bin width:
Use bin widths 1.0 or 2.0 for each dimension:
Specify bin range and bin width:
Use the range from to with bin widths and :
Explicitly give bin delimiters:
Use the bin delimiters and :
Use different automatic binning methods:
Use different bin specifications in each dimension:
Specify 3 bins in the row dimension and bin width 0.5 in the column dimension:
 Applications   (5)
Compare an estimated density to a theoretical model:
Distribution of lengths of human chromosomes:
Compute the probability that the sequence length is greater than 15:
Compare the distributions of word length for some of the parts of speech:
The expected number of characters for a randomly chosen English noun:
Estimate the distribution of day-to-day point changes in the S&P 500 index:
Compute the probability of a 1% point change or more on a given day:
Determine the number of bins to use for bimodal data by Knuth's Bayesian method:
The optimal number of bins maximizes the log of the posterior density:
Density estimates using Knuth's method, Scott's rule, and the Freedman-Diaconis rule:
Knuth's method outperforms the other two in terms of LogLikelihood:
The PDF of HistogramDistribution is equivalent to a probability density Histogram:
The resulting density estimate integrates to unity:
The precision of the output matches the precision of the data:
The PDF is piecewise constant:
The CDF and SurvivalFunction are piecewise linear:
The HazardFunction is linear fractional:
HistogramDistribution is a MixtureDistribution of uniform distributions:
HistogramDistribution is a consistent estimator of the underlying distribution:
It is possible to drop data from the estimation by specifying a binning range:
Specifying a width alone uses all the data:
Random pop art with HistogramDistribution:
New in 8