HistogramDistribution

HistogramDistribution[{x1, x2, ...}]
represents the probability distribution corresponding to a histogram of the data values .

HistogramDistribution[{{x1, y1, ...}, {x2, y2, ...}, ...}]
represents a multivariate histogram distribution based on data values .

HistogramDistribution[..., bspec]
represents a histogram distribution with bins specified by bspec.

DetailsDetails

  • HistogramDistribution returns a DataDistribution object that can be used like any other probability distribution.
  • 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:
  • nuse n bins
    {w}use bins of width w
    {min,max,w}use bins of width w from min to max
    {{b1,b2,...}}use bins
    Automaticdetermine bin widths automatically
    "name"use a named binning method
    fwapply 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.
  • HistogramDistribution can be used with such functions as Mean, CDF, and RandomVariate.

ExamplesExamplesopen allclose all

Basic Examples (2)Basic Examples (2)

Create a histogram distribution of univariate data:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input

Use the resulting distribution to perform analysis, including visualizing distribution functions:

In[3]:=
Click for copyable input
Out[3]=

Compute moments and quantiles:

In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
Out[5]=

Create a histogram distribution of bivariate data:

In[1]:=
Click for copyable input
In[2]:=
Click for copyable input

Visualize the PDF and CDF:

In[3]:=
Click for copyable input
Out[3]=

Compute covariance and general moments:

In[4]:=
Click for copyable input
Out[4]//MatrixForm=
In[5]:=
Click for copyable input
Out[5]=
New in 8
New to Mathematica? Find your learning path »
Have a question? Ask support »