# Estimating parameters for a large number of fair and unfair coins

Suppose we have N coins. We know that at least half of them are fair. Suppose we flip coin $i$ for $n_i$ times and $x_i$ denotes number of heads. Given $n = (n_1, \dots , n_N)$ and $x = (x_1,\dots,x_N)$. What methods can be used to estimate $p_i$s? ($p_i$ is probability of head for coin $i$)

EDIT:

1- $n_i$ does not follow a particular distribution and is given to us without any additional information.

2- We are seeking to minimize sum of squared errors of estimated $p_i$s.

notes:

1- There may not be a general answer that works best for all situations without any additional assumptions. I have a data-set for which I am supposed to solve this problem. Histogram of $\frac{x_i}{n_i}$ is like

It seems that there are a fraction of coins for which p is very close to 0!

2- I was thinking about computing p-value for each coin with being fair as null hypothesis and reject this hypothesis for weird observations! But I don't know how to determine number of rejections and also estimating $p_i$ for non-rejected $i$s is the second question!

3- Is Stein's paradox or James-Stein Estimator relevant here? If using empirical bayes is appropriate here what kind of prior do you suggest?

• (1) How do you decide what each $n_i$ should be? (2) What would it cost to make errors? They are of two types here: (a) discrepancies between each estimate $\hat p_i$ and its true value $p_i$ and (b) a discrepancy that would arise if more than half the estimates are less that $1/2$. If you don't care about (b), your problem is easy: estimate the $p_i$ individually and independently. If you do care about (b), incorporating that into a solution requires informing us in a quantitative way how to balance the costs of the two kinds of discrepancies. – whuber Jul 26 '17 at 13:49
• @whuber I updated my question but I didn't understand exactly what you mean in part (b). – Dandelion Jul 26 '17 at 13:59