From the calculator above: If N=7 and p=0.3 you will get exactly 5 successes 2.5% of the time.
If N=8 and p=0.3 you will get exactly 5 successes 4.6% of the time.
If N=30 and p=0.3 you will get 4 or fewer successes 3.0% of the time.
So I think the range of N you need for 95% confidence is 7 to 30.
Function SolveForAlpha(r As Integer, p As Double, alpha As Double) As Integer
Dim q As Integer
'lowest test n we can have is r
q = r
Do Until probGE(q, r, p) >= alpha
q = q + 1
Loop
SolveForAlpha = q
End Function
Function probGE(n As Integer, r As Integer, p As Double) As Double
Dim c As Integer
For c = r To n
probGE = probGE + prob(n, c, p)
Next
End Function
Function prob(n As Integer, r As Integer, p As Double) As Double
prob = p ^ r * (1 - p) ^ (n - r) * nCr(n, r)
End Function
Function nCr(n As Integer, r As Integer) As Double
Dim c As Integer
nCr = fact(n) / fact(r) / fact(n - r)
End Function
Function fact(ByVal n As Integer) As Double
If n <= 0 Then
fact = 1
Else
fact = fact(n - 1) * n
End If
End Function
Title | # Comments | Views | Activity |
---|---|---|---|
First Mechanical Kit ? | 3 | 56 | |
Two list de-cypher | 6 | 86 | |
Logarithms | 2 | 52 | |
Access question - internal training | 9 | 50 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
20 Experts available now in Live!