MathGroup Archive 1999

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

Search the Archive

Re: Re: binomial distribution

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16955] Re: [mg16915] Re: [mg16895] binomial distribution
  • From: "Arnold Knopfmacher" <arnoldk at cam.wits.ac.za>
  • Date: Thu, 8 Apr 1999 02:32:49 -0400
  • Organization: MS, University of the Witwatersrand
  • Sender: owner-wri-mathgroup at wolfram.com

Dear Bob

While using Evaluate may be fast I should point out that its highly inaccurate.
For example observe the zigzag effect from your function of

lst= PrBinomial[#,84,0.2]& /@ Range[20]
ListPlot[%,PlotJoined->True,PlotRange->All]

Using greater accuracy one gets the correct monotonicity of the graph:

PrBinomial2[c_, n_, p_] := 
  N[Sum[Binomial[n, k]*(1 - p)^k*p^(n - k), 
    {k, 0, c}],25]

lst= PrBinomial2[#,84,0.2]& /@ Range[20]

ListPlot[%,PlotJoined->True,PlotRange->All]

Regards
Arnold Knopfmacher
Wits University

> Date:          Tue, 6 Apr 1999 01:27:38 -0400
> From:          BobHanlon at aol.com
To: mathgroup at smc.vnet.net
> To:            mathgroup at smc.vnet.net
> Subject: [mg16955]       [mg16915] Re: [mg16895] binomial distribution

> 
> In a message dated 4/5/99 3:52:02 AM, robert.wright4 at virgin.net writes:
> 
> >Can someone explain how I can solve for 'c' or 'n' given the other variables
> >in this equation: its the binomial form for calculation the operating
> >characteristic in acceptance sampling. The problem is that 'c' and 'n'
> >are
> >discrete and therefore 'Findroot' or 'NSolve' do not work.
> >
> >The other problem is that it takes a long time to evaluate 'PrBinomial'
> >for
> >large 'c' and 'n'.... is there a better way of calculating?
> >
> >
> >\!\(PrBinomial[c_, \ n_, p_] := \
> >    Sum[\ Binomial[n, k]\ \(\((1 - p)\)\^k\) p\^\(n - k\), {k, 0, c}] //
> >N\)
> >
> 
> Robert,
> 
> PrBinomial[c_, n_, p_] := 
>   Evaluate[Sum[Binomial[n, k]*(1 - p)^k*p^(n - k), 
>     {k, 0, c}]]
> 
> Note the use of Evaluate.
> 
> x1 = PrBinomial[3,5,0.1];
> 
> FindRoot[PrBinomial[c,5,0.1]==x1, {c, 4, 5}]
> 
> {c\[Rule]3.}
> 
> FindRoot[PrBinomial[3,n,0.1]==x1, {n, 3, 4}]
> 
> {n\[Rule]5.}
> 
> x2 = PrBinomial[27,84,0.2];
> 
> If you know roughly what the solution should be 
> you can limit the search.  If not, check all values:
> 
> IntegerQQ[x_] := Chop[x - Round[x]] == 0;
> 
> eqn = PrBinomial[c,84,0.2]==x2;
> 
> soln = Select[c /.Table[FindRoot[eqn, {c, k, k+1}], {k, 0, 83}], 
>     IntegerQQ[#]&]
> 
> (* extraneous error messages removed *)
> 
> {6.,7.,10.,11.,14.,19.,17.,19.,19.,22.,25.,25.,27.,35.}
> 
> Rounding and eliminating duplicate solutions
> 
> soln = Union[Round[soln]]
> 
> {6,7,10,11,14,17,19,22,25,27,35}
> 
> Picking the best discrete solution
> 
> First[Sort[soln,
>     Abs[PrBinomial[#1,84,0.2]-x2] < Abs[PrBinomial[#2,84,0.2]-x2]&]]
> 
> 27
> 
> 
> Bob Hanlon
> 
> 


  • Prev by Date: Re: Help needed with List!
  • Next by Date: Re: Help needed with List!
  • Previous by thread: Re: Re: binomial distribution
  • Next by thread: Re: binomial distribution