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
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
how to find inverse of a nxn matrix when n is large ie n=8,10... | 9 | 36 | |
logic in c# | 10 | 68 | |
Statistics & Data Sceicne | 2 | 112 | |
Least Squares Curve Fitting | 4 | 61 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
16 Experts available now in Live!