MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Defining a Discrete Probability Distribution using ProbabilityDistribution

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122531] Re: Defining a Discrete Probability Distribution using ProbabilityDistribution
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Mon, 31 Oct 2011 06:50:46 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Look at the example under Scope>Discrete Univariate Distributions:

\[ScriptCapitalD] =
   ProbabilityDistribution[16^(2 x + 1)/(Sinh[16] (2 x + 1)!),
                {x, 0, \[Infinity], 1}];
DiscretePlot[Evaluate@PDF[\[ScriptCapitalD], x], {x, 0, 15},
  ExtentSize -> 1/2]

Now draw the very same function with Plot:

Plot[Evaluate@PDF[\[ScriptCapitalD], x], {x, 0, 15}]

This, as you can see, is NOT a discrete pdf.

This plot LOOKS like a discrete one:

DiscretePlot[Evaluate@CDF[\[ScriptCapitalD], x], {x, 0, 15},
  ExtentSize -> Right]

What we need is the heights of those bars:

heights = CDF[\[ScriptCapitalD], Range[0, 16]] // N
BarChart[heights]

{3.60113*10^-6, 0.000157249, 0.00212394, 0.0141114, 0.0567335, \
0.155927, 0.318706, 0.517141, 0.703903, 0.843702, 0.928913, 0.972023, \
0.990417, 0.997125, 0.999239, 0.999821, 0.999963}

Weights at the integers are given by

weights = Thread[{Range[0, 15], Differences@heights}]

{{0, 0.000153648}, {1, 0.00196669}, {2, 0.0119875}, {3,
   0.0426221}, {4, 0.0991933}, {5, 0.162779}, {6, 0.198435}, {7,
   0.186762}, {8, 0.139799}, {9, 0.0852107}, {10, 0.0431105}, {11,
   0.0183938}, {12, 0.00670772}, {13, 0.00211475}, {14,
   0.000582125}, {15, 0.000141121}}

or

Clear[weight]
SetAttributes[weight, Listable]
weight[-1] = 0;
weight[n_Integer?NonNegative] :=
  weight[n] =
   CDF[\[ScriptCapitalD], n] - CDF[\[ScriptCapitalD], n - 1]
ListPlot[weight@Range[0, 20]]

Bobby

On Sun, 30 Oct 2011 04:23:09 -0500, Jonathan Foley <jonefoley at gmail.com>  
wrote:

>
>
> I'm trying to use ProbabilityDistribution (http://
> reference.wolfram.com/mathematica/ref/ProbabilityDistribution.html) to
> define a discrete probability distribution given a pdf. The problem is
> I can't get it to actually be discrete:
>
> In: twostatedist =
>   ProbabilityDistribution[(Gamma[
>        a/d + N]/(Gamma[N + 1]*Gamma[a/d + b/d + N])*(Gamma[a/d + b/d]/
>        Gamma[a/d]) (c/d)^N*
>      Hypergeometric1F1[a/d + N, a/d + b/d + N, -c/d]), {N, 0,
>     Infinity, 1}, Assumptions -> {N \[Element] Integers && N >= 0}];
> params = {a -> 0.3, b -> 60/25, c -> 60, d -> 0.2};
> PDF[twostatedist /. params, 0.5]
>
> Out: 0.00976739
>
>
> This should yield a probability of 0 but it doesn't. Based on the
> documentation for a discrete distribution you are supposed to use the
> form ProbabilityDistribution[pdf,{x,xmin,xmax,dx}]. It is not
> explained what dx is, but I assumed this was the step size, so I set
> it to 1. I further tried to enforce discreteness by using Assumptions,
> but this doesn't appear to work.
>
> Does anyone know how to do this?
>


-- 
DrMajorBob at yahoo.com



  • Prev by Date: Re: Mathematica 8.0.4 now available
  • Next by Date: Assumptions - an issue. Does mathematica store it?
  • Previous by thread: Defining a Discrete Probability Distribution using ProbabilityDistribution
  • Next by thread: Mathematica 8.0.4 with Lion 7.0.2