Order in a Biased Coin

Your goal here is to test the marginal probability of a head in your coins. However, you need to be careful with your assumptions. You say in your question that the coin tosses are independent, but the data for the coins clearly falsifies this. The standard coin-toss model with independent outcomes is based on an assumption of exchangeability of the outcomes, which can be tested via a permutation test (e.g., a runs test). For a binary process with twenty observed tails and thirty observed heads, the distribution of the number of runs is shown in the plot below (R code for this plot below).

enter image description here

In your data, Coin 1 has two runs and Coin 2 has ten runs. Two runs is so far in the tails that we do not get a single random generation of this in $10^6$ simulations, yielding a simulated p-value of zero. Ten runs is so far in the tails that we get a value as or more extreme than this only seven times in $10^6$ simulations, yielding a simulated p-value close to zero. In short, for both coins ( but especially the first), there is extremely strong evidence that exchangeability does not hold, so the tosses are not independent (even when we condition on the marginal probability of a head).

Given that your coin tosses show evidence of non-exchangeability, you need to base your analysis on some kind of more general model (e.g., a binary auto-regression (BAR) model). Now, you might still find that the evidence for the marginal probability of heads is the same in both cases, under a more general model. However, you cannot base this on an assumption of independence of tosses, which is clearly falsified by the observed data.


R code for this plot:

#Define a function to calculate the runs for an input vector
RUNS <- function(x) { n <- length(x);
                      R <- 1;
                      for (i in 2:n) { if(x[i] != x[i-1]) { R <- R+1; } }
                      R }

#Simulate the runs statistic for k permutations
k <- 10^6;
set.seed(12345);
RR <- rep(0, k);
for (i in 1:k) { x_perm <- sample(x, length(x), replace = FALSE);
                 RR[i] <- RUNS(x_perm); }

#Generate the frequency table for the simulated runs
FREQS <- as.data.frame(table(RR));

#Plot estimated distribution of runs
library(ggplot2);
ggplot(data = FREQS, aes(x = RR, y = Freq/k, colour = 'Red', fill = 'Red')) +
       geom_bar(stat = 'identity') +
       theme(legend.position = 'none') +
       labs(title ='Plot of Distribution of Runs',
       subtitle = '(Simulation using 1,000,000 generated values)',
       x = 'Runs', y = 'Estimated Probability'); 

A detailed answer has already been given under the assumption that the independence of the coin tosses is in question. I interpreted the question to mean that the independence assumption stands and you merely want to consider the possibility of the coin being biased away from the uniform distribution for $p=\frac12$.

In this case, the answer to Question $1$ is affirmative. In this experiment, the number of heads is a sufficient statistic for the parameter $p$ of interest, the probability of the coin to yield heads. That is, it contains all the information about this parameter that the entire run of data contains. Formally, the likelihood of the parameter conditional on the statistic is the same as the likelihood of the parameter conditional on the entire data. Thus, the order in which the results occur makes no difference in your posterior beliefs about the parameter.

Tags:

Probability