Re: Manipulating a Binomial CDF
- To: mathgroup at smc.vnet.net
- Subject: [mg94040] Re: [mg94035] Manipulating a Binomial CDF
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Wed, 3 Dec 2008 05:41:57 -0500 (EST)
- Reply-to: hanlonr at cox.net
The PlotRange is changing (particularly for the CDF) and the x-axes crossing is not at 0. Use the PlotRange option to control this (e.g., PlotRange -> {0, 1} )
Bob Hanlon
---- Jamie Coventry <jcoventry at renaissance.edu.hk> wrote:
=============
Hi,
I have a query with a plot I'm doing with the code below. When I take
the "probability of success" slider down to values less than 0.2, the
graph of the BinomialCDF displays strange behaviour at n=0. The value
of P(N=E2=89=A40) is calculated correctly, but the point is displayed below
the horizontal axes.
Can anyone explain this?
Here's the code:
Manipulate[
Grid[{{
ListPlot[
Table[Tooltip[{i, PDF[BinomialDistribution[n, p], i]}], {i, 0,
n}],
Filling -> Axis, FillingStyle -> Directive[Blue, Thick],
PlotLabel -> Style["Probability density", 14, Bold],
ImageSize -> {280, 280}, AxesLabel -> {"n", "p"},
PlotStyle -> {Thick, PointSize[Large]}],
ListPlot[
Table[Tooltip[{i, CDF[BinomialDistribution[n, p], i]}], {i, 0,
n}],
Filling -> Axis, FillingStyle -> Directive[Blue, Thick],
PlotLabel -> Style["Probability density", 14, Bold],
ImageSize -> {280, 280}, AxesLabel -> {"n", "p"},
PlotStyle -> {Thick, PointSize[Large]}],
}}]
, {{n, 10, "Number of terms"}},
{{p, 0.5, "Probability of success"}, 0, 1, 0.01}]
Thanks in advance,
Jamie
--
Bob Hanlon