Re: Plotting a discrete probability distribution
- To: mathgroup at smc.vnet.net
- Subject: [mg30550] Re: [mg30531] Plotting a discrete probability distribution
- From: BobHanlon at aol.com
- Date: Wed, 29 Aug 2001 01:39:55 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 2001/8/28 5:47:35 AM, dot at dot.dot writes:
>This will sound strange, but I would like to plot values defined by the
>function for the Poisson Distribution PDF, but for values that are not
>integers, and therefore not strictly part of the PDF
>
>PDF[PoissonDistribution[3],x] returns the function in x as one would expect,
>namely
>
>3^x/(E^3 * x!)
>
>I can now substitute values for x using
>
>/. x->valueWanted
>
>and have the function evaluate at valueWanted, but
>Plot[ PDF[PoissonDistribution[3],x], {x, 0, 5}]
>does not produce anything.
>
>Ah, I've just seen that I can do it with Evaluate around the PDF, but
>(1) *why* do I need it, when I do not need it with NormalDistribution?
>(2) If I want to evaluate (plot) values in the extremities of the
>PoissonDistribution, how can I push the precision in this case beyond
>MachinePrecision so that I do not just get zero?
Needs["Statistics`DiscreteDistributions`"];
Needs["Graphics`Colors`"];
You are plotting the envelope of the PDF. A discrete PDF is composed of
impulses.
mu = 3;
Plot[Evaluate[
PDF[PoissonDistribution[mu], x]],
{x, -0.25, 10.25},
PlotStyle -> {Blue, AbsoluteDashing[{5, 5}]},
Epilog -> {Red,
Table[Line[{{x, 0},
{x, PDF[PoissonDistribution[mu], x]}}],
{x, 0, 10}]},
Frame -> True, Axes -> False,
FrameLabel -> {"\nx", "PDF\n"},
PlotLabel -> "Poisson Distribution (mu = " <>
ToString[mu] <> ")",
ImageSize -> 400];
Plot[Evaluate[
PDF[PoissonDistribution[mu], x]],
{x, 7.85, 12.15},
PlotStyle -> {Blue, AbsoluteDashing[{5, 5}]},
Epilog -> {Red,
Table[Line[{{x, 0},
{x, PDF[PoissonDistribution[mu], x]}}],
{x, 8, 12}]},
Frame -> True, Axes -> False,
FrameLabel -> {"\nx", "PDF\n"},
PlotLabel -> "Poisson Distribution (mu = " <>
ToString[mu] <> ")",
ImageSize -> 400];
Bob Hanlon
Chantilly, VA USA