MathGroup Archive 2006

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

Search the Archive

Re: BinomialDistribution

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65228] Re: [mg65222] BinomialDistribution
  • From: "Carl K. Woll" <carlw at wolfram.com>
  • Date: Sun, 19 Mar 2006 03:19:05 -0500 (EST)
  • References: <200603181140.GAA09803@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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?

It's a precision problem. With Integrate you are computing the 
indefinite integral and then pluggung in limits. The indefinite integral 
experiences subtractive cancellation at the end point .29, as it 
involves the sum of 76 terms. If you really like Integrate, then you 
will need to increase precision,

In[6]:=
Integrate[PDF[BinomialDistribution[101,u],26],{u,0,.29`50}]

Out[6]=
0.00731803126398322522898392347590

On the other hand, if you are willing to use NIntegrate, then 
subtractive cancellation is not an issue:

In[7]:=
NIntegrate[PDF[BinomialDistribution[101,u],26],{u,0,.29}]

Out[7]=
0.00731803

Carl Woll
Wolfram Research


  • Prev by Date: Re: Combined Graphics3D with Separate PlotRange?
  • Next by Date: Re: A Reap Sow question
  • Previous by thread: Re: BinomialDistribution
  • Next by thread: Re: BinomialDistribution