Skip to main content
Post Closed as "Duplicate" by MarcoB, user9660, Dr. belisarius, Mr.Wizard plotting
edited tags
Link
Routine clean-up
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259

Gaps in CDFthe plot of a cumulative distribution function produced from HistogramDistribution

I have about 200 real numbers spread over the range 0-400. I use HistogramDistribution to bin them and PDF to create the resulting step-wise probability distribution. II assumed that CDF applied to the HistogramDistribution would yield a continuous, piece-wise linear function, but I keep getting these annoying gaps in the plot of the CDF. Here's

Here's the code I'm using applied to some random data:

data = Table[400*RandomReal[], {200}];
pd = PDF[HistogramDistribution[data, 20]];
Plot[pd[x], {x, 0, 400}]
Plot[CDF[HistogramDistribution[data, 20], x], {x, 0, 400}]

Any idea what's causing the gaps and how to get rid of them?

Gaps in CDF produced from HistogramDistribution

I have about 200 real numbers spread over the range 0-400. I use HistogramDistribution to bin them and PDF to create the resulting step-wise probability distribution. I assumed that CDF applied to the HistogramDistribution would yield a continuous, piece-wise linear function, but I keep getting these annoying gaps in the CDF. Here's the code I'm using applied to some random data:

data = Table[400*RandomReal[], {200}];
pd = PDF[HistogramDistribution[data, 20]];
Plot[pd[x], {x, 0, 400}]
Plot[CDF[HistogramDistribution[data, 20], x], {x, 0, 400}]

Any idea what's causing the gaps and how to get rid of them?

Gaps in the plot of a cumulative distribution function produced from HistogramDistribution

I have about 200 real numbers spread over the range 0-400. I use HistogramDistribution to bin them and PDF to create the resulting step-wise probability distribution. I assumed that CDF applied to the HistogramDistribution would yield a continuous, piece-wise linear function, but I keep getting these annoying gaps in the plot of the CDF.

Here's the code I'm using applied to some random data:

data = Table[400*RandomReal[], {200}];
pd = PDF[HistogramDistribution[data, 20]];
Plot[pd[x], {x, 0, 400}]
Plot[CDF[HistogramDistribution[data, 20], x], {x, 0, 400}]

Any idea what's causing the gaps and how to get rid of them?

Tweeted twitter.com/StackMma/status/691562115686080512
Formatted code, added plotting tag, since the problem is really in the plotting and not in the calculation
Source Link
MarcoB
  • 67.7k
  • 18
  • 96
  • 198

I have about 200 real numbers spread over the range 0-400. I use HistogramDistribution[]HistogramDistribution to bin them and PDF[]PDF to create the resulting step-wise probability distribution. I assumed that CDF[]CDF applied to the HistogramDistribution[]HistogramDistribution would yield a continuous, piece-wise linear function, but I keep getting these annoying gaps in the CDF. Here's the code I'm using applied to some random data:

data = Table[400*RandomReal[], {200}];
pd = PDF[HistogramDistribution[data, 20]];
Plot[pd[x], {x, 0, 400}]
Plot[CDF[HistogramDistribution[data, 20], x], {x, 0, 400}]

Any idea what's causing the gaps and how to get rid of them?

I have about 200 real numbers spread over the range 0-400. I use HistogramDistribution[] to bin them and PDF[] to create the resulting step-wise probability distribution. I assumed that CDF[] applied to the HistogramDistribution[] would yield a continuous, piece-wise linear function, but I keep getting these annoying gaps in the CDF. Here's the code I'm using applied to some random data:

data = Table[400*RandomReal[], {200}];
pd = PDF[HistogramDistribution[data, 20]];
Plot[pd[x], {x, 0, 400}]
Plot[CDF[HistogramDistribution[data, 20], x], {x, 0, 400}]

Any idea what's causing the gaps and how to get rid of them?

I have about 200 real numbers spread over the range 0-400. I use HistogramDistribution to bin them and PDF to create the resulting step-wise probability distribution. I assumed that CDF applied to the HistogramDistribution would yield a continuous, piece-wise linear function, but I keep getting these annoying gaps in the CDF. Here's the code I'm using applied to some random data:

data = Table[400*RandomReal[], {200}];
pd = PDF[HistogramDistribution[data, 20]];
Plot[pd[x], {x, 0, 400}]
Plot[CDF[HistogramDistribution[data, 20], x], {x, 0, 400}]

Any idea what's causing the gaps and how to get rid of them?

Source Link
Loading