0
$\begingroup$

Is there a way to solve for the probability p of a binomial distribution in a set of equations? With some arbitrary functions g[ _ ] and f[ _ ] such that:

eq1 = -g[y] + Sqrt[g[y]^2 + 4*5*5/200] (200^2/2*5) - x
eq2 := Sum[PDF[BinomialDistribution[15, y], i]*f [i], {i, 0, 15}] - 10*x
bif = NSolve[eq1 == 0, eq2 == 0, {x, y}]

I even simplified it to:

f[x_] := 0.34*Exp[-150*x]

eq1 := Sum[
   Probability[BinomialDistribution[15, y], x]*f[x], {x, 0, 15}] - 10
bif = NSolve[eq1 == 0, {y}]

However the output I get is:

NSolve[-10 + 
   2.43953*10^-66 Probability[BinomialDistribution[15, y], 0] + 
   0.337692 Probability[BinomialDistribution[15, y], 1] + 
   0.34 Probability[BinomialDistribution[15, y], 2] + 
   0.34 Probability[BinomialDistribution[15, y], 3] + 
   0.34 Probability[BinomialDistribution[15, y], 4] + 
   0.34 Probability[BinomialDistribution[15, y], 5] + 
   0.34 Probability[BinomialDistribution[15, y], 6] + 
   0.34 Probability[BinomialDistribution[15, y], 7] + 
   0.34 Probability[BinomialDistribution[15, y], 8] + 
   0.34 Probability[BinomialDistribution[15, y], 9] + 
   0.34 Probability[BinomialDistribution[15, y], 10] + 
   0.34 Probability[BinomialDistribution[15, y], 11] + 
   0.34 Probability[BinomialDistribution[15, y], 12] + 
   0.34 Probability[BinomialDistribution[15, y], 13] + 
   0.34 Probability[BinomialDistribution[15, y], 14] + 
   0.34 Probability[BinomialDistribution[15, y], 15] == 0, {y}]

Effectively it is just solving this coupled system of equations. However, Mathematica does not provide a solution when I use the binomial function. The exact parameters don't matter, it's more a general question on how to solve these types of problems. I hope you can help :)

(Mathematica newbie here)

$\endgroup$
6
  • $\begingroup$ Try NSolve~ or FindRoot`. $\endgroup$
    – bbgodfrey
    Sep 29 '21 at 13:27
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Sep 29 '21 at 13:27
  • 2
    $\begingroup$ I think you need to change PDF[Binomial[15, y], i] to PDF[BinomialDistribution[15, y], i]. You can solve for x in both equations and then solve for y but solving for y probably requires knowing $g$ and/or $f$. $\endgroup$
    – JimB
    Sep 29 '21 at 15:35
  • $\begingroup$ You need to change Probability to PDF. $\endgroup$
    – JimB
    Oct 1 '21 at 7:12
  • $\begingroup$ I suspect you need the restriction $0<y\leq 1$ but if you plot eq1 (from your simplified example), there is no value of $y$ in that range where eq1==0. $\endgroup$
    – JimB
    Oct 1 '21 at 16:16
0
$\begingroup$

Try first the simpler problem: solve for p, for example

NSolve[CDF[BinomialDistribution[50, p], 35] == 0.025, p] // Quiet

The solution is obtained right away {{p -> 0.821382}}

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.