RE: Manipulating a Binomial CDF
- To: mathgroup at smc.vnet.net
- Subject: [mg94058] RE: [mg94035] Manipulating a Binomial CDF
- From: "David Park" <djmpark at comcast.net>
- Date: Wed, 3 Dec 2008 05:45:11 -0500 (EST)
- References: <gh0jl6$5mk$1@smc.vnet.net> <200812020543.AAA19191@smc.vnet.net> <6111586.1228214152726.JavaMail.root@m02>
Jamie, With dynamic plots and animations it always helps to include an explicit PlotRange option. Manipulate[ Grid[{ {ListPlot[Table[Tooltip[{i,PDF[BinomialDistribution[n,p],i]}],{i,0,n}], PlotRange->{{-.5,n+.5},{-.05,1.05}},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}], PlotRange->{{-.5,n+.5},{-.05,1.05}}, 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}] David Park djmpark at comcast.net http://home.comcast.net/~djmpark From: Jamie Coventry [mailto:jcoventry at renaissance.edu.hk] 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
- References:
- Re: Mathematica computes a different answer in version 7
- From: mark mcclure <mcmcclur@unca.edu>
- Re: Mathematica computes a different answer in version 7