<< distfun_histornd Histogram Hypergeometric >>

distfun >> distfun > Histogram > distfun_histostat

distfun_histostat

Histogram mean and variance

Calling Sequence

M=distfun_histostat(h)
[M,V]=distfun_histostat(h)

Parameters

h :

an histogram object

M :

a matrix of doubles, the mean

V :

a matrix of doubles, the variance

Description

Computes statistics from the histogram.

The h object must be created with distfun_histocreate.

The Mean and Variance of the Histogram Distribution are:

\begin{eqnarray}
M &=& \frac{1}{2S} \sum_{i=1}^{nbins} f_i l_i (e_i+e_{i+1}) \\
V &=& \frac{1}{3S} \sum_{i=1}^{nbins} f_i l_i (e_i^2+e_i e_{i+1}+e_{i+1}^2),
\end{eqnarray}

where

S= \sum_{i=1}^{nbins} f_i l_i,

e_i are the edges of the bins, f_i are the heights of the histogram and l_i=e_{i+1}-e_i are the lengths of the bins.

Examples

m=1000;
data=distfun_normrnd(0,1,m,1);
h=distfun_histocreate("data",data);
[M,V]=distfun_histostat(h)

Authors


Report an issue
<< distfun_histornd Histogram Hypergeometric >>