MathGroup Archive 1999

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

Search the Archive

Re: binomial distribution

  • To: mathgroup at
  • Subject: [mg16915] Re: [mg16895] binomial distribution
  • From: BobHanlon at
  • Date: Tue, 6 Apr 1999 01:27:38 -0400
  • Sender: owner-wri-mathgroup at

In a message dated 4/5/99 3:52:02 AM, robert.wright4 at 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'
>discrete and therefore 'Findroot' or 'NSolve' do not work.
>The other problem is that it takes a long time to evaluate 'PrBinomial'
>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}] //


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}]


FindRoot[PrBinomial[3,n,0.1]==x1, {n, 3, 4}]


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}], 

(* extraneous error messages removed *)


Rounding and eliminating duplicate solutions

soln = Union[Round[soln]]


Picking the best discrete solution

    Abs[PrBinomial[#1,84,0.2]-x2] < Abs[PrBinomial[#2,84,0.2]-x2]&]]


Bob Hanlon

  • Prev by Date: Re: Re: Re: Precision graphics
  • Next by Date: Time Series/Kalman Filter
  • Previous by thread: binomial distribution
  • Next by thread: Re: Re: binomial distribution