Thread: solver
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default solver


John wrote:
Dana,

Thank you for your helpful comments. I am looking for a solution, and a
graphical solution that works is perfectly acceptable. Do you mind
telling me what you plotted?

John Adams


Here's a simple non-graphical method of solving the problem

If you start with cguess = 0

and calculate

nguess = comp_crit_negbinomial(p2,cguess+1,beta)+cguess+1

and

cguess = comp_crit_binomial(nguess,p1,alpha)

iteratively until the new value of cguess does not change, you will
have solved the problem.


At each stage nguess is the smallest sample size such that
binomdist(cguess,nguess,p2,true) <= beta
and cguess is the smallest value such that
binomdist(cguess,nguess,p1,true) = 1 - alpha.

comp_crit_binomial(nguess,p1,alpha) is essentially
CRITBINOM(nguess,p1,1-alpha). Unfortunately, there is no critical value
function for the negative binomial in Excel.

You can find both comp_crit_negbinomial and comp_crit_binomial in the
spreadsheet http://members.aol.com/iandjmsmith/Examples.xls and the VBA
code itself can be found at
http://members.aol.com/iandjmsmith/Examples.txt should you wish to add
your own function to do this calculation. Of course, you can improve on
0 as an initial guess for c by using normal approximations...

In the two examples you give, the solutions agree with Dana's graphical
solutions. The graphical solution may still be preferable if the
purpose of the exercise is to show people how to solve the problem.

Ian Smith