Re: BinomialDistribution
- To: mathgroup at smc.vnet.net
- Subject: [mg65226] Re: BinomialDistribution
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Sun, 19 Mar 2006 03:19:03 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 3/18/06 at 6:40 AM, J.A.Solomon at city.ac.uk (Solomon, Joshua) wrote: >This makes me feel foolish. >In[1]:=Needs["Statistics`DiscreteDistributions`"] >In[2]:=Plot[PDF[BinomialDistribution[101,u],26],{u,0,0.5},PlotRange >->All] >This gives me a nice, bell-shaped curve, with a minimum of about 0 >and a maximum of about .09. Let's integrate it from 0 to .29. >In[3]:=Integrate[PDF[BinomialDistribution[101,u],26],{u,0,.29}] >Out[3]=-0.612253 >How can this be negative? The problem is the default precision when Integrate substitutes values for u into the symbolic solution. The simplest solution is to use NIntegrate instead of Integrate, i.e., In[12]:= NIntegrate[PDF[BinomialDistribution[101,u],26],{u,0,.29}] Out[12]= 0.00731803 Equivalently, you could change the limits for integration to an exact number and convert the answer to a machine precision number using N, i.e, In[13]:= Integrate[PDF[BinomialDistribution[101,u],26],{u,0,29/100}]//N Out[13]= 0.00731803 -- To reply via email subtract one hundred and four