So for example, to calcuate how many times would I need to toss a coin to observe that p(heads)=0.5, within 95%CI?

Thank you,

Thomas

- Thread starter ThomasCNot
- Start date
- Tags confidence interval observed probability

So for example, to calcuate how many times would I need to toss a coin to observe that p(heads)=0.5, within 95%CI?

Thank you,

Thomas

So for example, to calcuate how many times would I need to toss a coin to observe that p(heads)=0.5, within 95%CI?

you assume it is approximately standard normal the 95% confidence interval +/- 1.96 standard errors. So the total length is about 4 standard errors and the standard error is sqrt(p(1-p)/n).... p(1-p) is maximized for p=0.5 ... so if n is chosen large enough to ensure an interval shorter than L for p=0.5 it will also hold when p is not 0.5.

you can read more http://en.wikipedia.org/wiki/Sample_size_determination

1. Take some observations, say 100 to get a feel for what p might be (observations for me are cheap).

2. Let's say it looks like p=0.1. Using the formula, calculate n when 4*sqrt(p(1-p)/n)=W units wide interval. So then all I'd have to do is choose an acceptable interval.

heres a table of standard errors sqrt(p(1-p)/n)*100 for different sample sizes - columns - and different p's - rows. The standard errors are multiplied with 100 so they are en percentage points.

Code:

```
100 500 1000 1500 2000 2500 3000 3500 4000 4500 5000
0.1 3.000000 1.341641 0.9486833 0.7745967 0.6708204 0.6000000 0.5477226 0.5070926 0.4743416 0.4472136 0.4242641
0.15 3.570714 1.596872 1.1291590 0.9219544 0.7984360 0.7141428 0.6519202 0.6035609 0.5645795 0.5322906 0.5049752
0.2 4.000000 1.788854 1.2649111 1.0327956 0.8944272 0.8000000 0.7302967 0.6761234 0.6324555 0.5962848 0.5656854
0.25 4.330127 1.936492 1.3693064 1.1180340 0.9682458 0.8660254 0.7905694 0.7319251 0.6846532 0.6454972 0.6123724
0.3 4.582576 2.049390 1.4491377 1.1832160 1.0246951 0.9165151 0.8366600 0.7745967 0.7245688 0.6831301 0.6480741
0.35 4.769696 2.133073 1.5083103 1.2315302 1.0665365 0.9539392 0.8708234 0.8062258 0.7541552 0.7110243 0.6745369
0.4 4.898979 2.190890 1.5491933 1.2649111 1.0954451 0.9797959 0.8944272 0.8280787 0.7745967 0.7302967 0.6928203
0.45 4.974937 2.224860 1.5732133 1.2845233 1.1124298 0.9949874 0.9082951 0.8409179 0.7866066 0.7416198 0.7035624
0.5 5.000000 2.236068 1.5811388 1.2909944 1.1180340 1.0000000 0.9128709 0.8451543 0.7905694 0.7453560 0.7071068
0.55 4.974937 2.224860 1.5732133 1.2845233 1.1124298 0.9949874 0.9082951 0.8409179 0.7866066 0.7416198 0.7035624
0.6 4.898979 2.190890 1.5491933 1.2649111 1.0954451 0.9797959 0.8944272 0.8280787 0.7745967 0.7302967 0.6928203
0.65 4.769696 2.133073 1.5083103 1.2315302 1.0665365 0.9539392 0.8708234 0.8062258 0.7541552 0.7110243 0.6745369
0.7 4.582576 2.049390 1.4491377 1.1832160 1.0246951 0.9165151 0.8366600 0.7745967 0.7245688 0.6831301 0.6480741
0.75 4.330127 1.936492 1.3693064 1.1180340 0.9682458 0.8660254 0.7905694 0.7319251 0.6846532 0.6454972 0.6123724
0.8 4.000000 1.788854 1.2649111 1.0327956 0.8944272 0.8000000 0.7302967 0.6761234 0.6324555 0.5962848 0.5656854
0.85 3.570714 1.596872 1.1291590 0.9219544 0.7984360 0.7141428 0.6519202 0.6035609 0.5645795 0.5322906 0.5049752
0.9 3.000000 1.341641 0.9486833 0.7745967 0.6708204 0.6000000 0.5477226 0.5070926 0.4743416 0.4472136 0.4242641
```