Re: Histogram
- To: mathgroup at smc.vnet.net
- Subject: [mg108749] Re: Histogram
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Tue, 30 Mar 2010 05:01:01 -0500 (EST)
On 3/29/10 at 6:58 AM, lambaugh at gmail.com (Jim Lambaugh) wrote:
>The reason why I am asking (I should have included this in my first
>post) is because I am trying to find a way to determine the size of
>the largest gap between the values I have in my list.
Hmm... I don't see how a histogram with infinitely small bins
would help with this. Finding the largest gap between a list of
values is easily done as follows:
In[1]:= data = RandomReal[1, 10];
In[2]:= Max@Differences[Sort@data]
Out[2]= 0.292657
But if you want something that simulates a histogram with
infinitely small bin widths you could do something like:
data = RandomReal[1, 100];
f = Interpolation[Transpose@{Sort[data], (Range[100] - .5)/100},
InterpolationOrder -> 1];
f will be the cumulative distribution function. Note, using
InterpolationOrder->1 is needed to ensure f is never decreasing.
Since a histogram is simply the probability density function
which is the derivative of the cumulative distribution function
Plot[(f[x+.0001]-f[x])/.0001, {x, 0, 1}]
will be the desired histogram.
Note, because of using InterpolationOrder->1, the derivative is
not continuous. So, the resulting plot will not be a smooth
curve. It is possible to achieve this. But that requires a more
sophisticated approach to estimating the probability density
function than a simple histogram.