Agent Smith said:
Fair would be 50/50 heads and tails. Proportion of heads = pH=0.5±0.02 (that's the interval [0.48, 0.52] and proportion of tails = 1−pH. That would be my first choice.
Second choice, I want to be 95% confident that the coin is fair.
Perfect, with these we can proceed.
Agent Smith said:
How do I use my data to compute P(E|H) and P(E)?
P(E) is just a normalization that we use to scale the right hand side of the equation so that the integral is 1 (because a probability density function has to integrate to 1 by definition).
Coin flips can be represented as a
binomial distribution B(n,p). In this case you are doing ##n=1000## flips, and the probability of heads on each flip is ##p=H##. So $$P(E|H)=\binom{1000}{E} H^E (1-H)^{1000-E}$$
The next thing is to choose your prior. This is your belief in the fairness of the coin (including your uncertainty). For a binomial likelihood like we have here, there is a very convenient form of the prior called a
conjugate prior. For the binomial likelihood the conjugate prior is the
beta distribution. If our prior is a beta distribution ##\beta(a,b)## then our posterior will be ##\beta(a+E,b+(1000-E))##.
So let's say that we wanted to say that we had a completely uniform prior. In other words, before running the experiment we did not have any reason to believe that the coin would land heads 50% of the time versus 99% of the time. This is called a uniform or uninformative prior. So that would be a prior of ##\beta(1,1)##.
Scenario 1. After observing ##E=490## heads (and ##1000-E=510## tails) then we would have the posterior distribution ##\beta(491,511)##. This has a probability of ##0.708## of being within the ROPE. So this is evidence that the coin is probably practically fair, but it is not strong enough evidence to meet your confidence requirement. There is a non-negligible ~30% chance that it is not practically fair, given this data and the uninformed prior.
Scenario 2. After observing ##E=358## heads (and ##1000-E=642## tails) then we would have the posterior distribution ##\beta(359,643)##. This has a probability of ##3.55 \ 10^{-15}## of being within the ROPE. This is pretty strong evidence that the coin is not practically fair.