public static double approximateLowerBoundOnP(final long n, final long k, final double numStdDevs) {
    checkInputs(n, k);
    if (n == 0) { return 0.0; } // the coin was never flipped, so we know nothing
    else if (k == 0) { return 0.0; }
    else if (k == 1) { return (exactLowerBoundOnPForKequalsOne(n, deltaOfNumStdevs(numStdDevs))); }
    else if (k == n) { return (exactLowerBoundOnPForKequalsN(n, deltaOfNumStdevs(numStdDevs))); }
    else {
      final double x = abramowitzStegunFormula26p5p22((n - k) + 1, k, (-1.0 * numStdDevs));
      return (1.0 - x); // which is p
    }
  }
public static double approximateLowerBoundOnP ( final long n , final long k , final double numStdDevs ) { checkInputs ( n , k ) ; if ( n == 0 ) { return 0.0 ; } else if ( k == 0 ) { return 0.0 ; } else if ( k == 1 ) { return ( exactLowerBoundOnPForKequalsOne ( n , deltaOfNumStdevs ( numStdDevs ) ) ) ; } else if ( k == n ) { return ( exactLowerBoundOnPForKequalsN ( n , deltaOfNumStdevs ( numStdDevs ) ) ) ; } else { final double x = abramowitzStegunFormula26p5p22 ( ( n - k ) + 1 , k , ( - 1.0 * numStdDevs ) ) ; return ( 1.0 - x ) ; } }
Computes lower bound of approximate Clopper-Pearson confidence interval for a binomial
proportion.

<p>Implementation Notes:<br>
The approximateLowerBoundOnP is defined with respect to the right tail of the binomial
distribution.</p>
<ul>
<li>We want to solve for the <i>p</i> for which sum<sub><i>j,k,n</i></sub>bino(<i>j;n,p</i>)
= delta.</li>
<li>We now restate that in terms of the left tail.</li>
<li>We want to solve for the p for which sum<sub><i>j,0,(k-1)</i></sub>bino(<i>j;n,p</i>)
= 1 - delta.</li>
<li>Define <i>x</i> = 1-<i>p</i>.</li>
<li>We want to solve for the <i>x</i> for which I<sub><i>x(n-k+1,k)</i></sub> = 1 - delta.</li>
<li>We specify 1-delta via numStdDevs through the right tail of the standard normal
distribution.</li>
<li>Smaller values of numStdDevs correspond to bigger values of 1-delta and hence to smaller
values of delta. In fact, usefully small values of delta correspond to negative values of
numStdDevs.</li>
<li>return <i>p</i> = 1-<i>x</i>.</li>
</ul>

@param n is the number of trials. Must be non-negative.
@param k is the number of successes. Must be non-negative, and cannot exceed n.
@param numStdDevs the number of standard deviations defining the confidence interval
@return the lower bound of the approximate Clopper-Pearson confidence interval for the
unknown success probability.