Find rows in data that are statistically different from the mean I have the following data for various event locations. Each event can either be a success or failure (binary values). Thus the mean = percentage of successes.
The data represent the history of events
$$\begin{array}{c|c|c}\rm Event\ location&\rm Number\ of\ events &\rm Mean\\\hline
A & 10 & 0.5\\
B & 2 & 1\\
C & 1 & 0\\
D & 100 & 0.3\\
E & 1 & 0\\
F & 1 & 1\\...&...&...\end{array}\\$$
I am looking for a way to find event locations whose chance of success in future events is low.
I am thinking of calculating the confidence in each locations success rate based on the sample of that location.
For example, having a location with only 1 or 2 events with either 0% or 100% success rate is likely as there are lots of such locations. However, a location with 100s of events but the mean very different from the overall mean is rare.
I am thinking of using the t-test to compare the mean of the event location with the overall mean and variance of the population.
Is there a better or another way to do this than the t-test? I feel this should be a common use case, find samples which are very different from others.
EDIT:
I found an option is to do a scipy.stats.binom_test on each row and use the p-value to find cases with high confidence. Still not sure if that is the best or the only way.
 A: You could do a binomial test for each site as you describe. Take the overall proportion as an estimate of the mean and then calculate the p-value for each site that the true probability at that site is the same as the overall mean. Display interest in any site with a p-value less than 0.01. I suggest taking a smaller significance level than the classic 0.05 because you are doing multiple testing.
You could also analyse your data as a 2 by n contingency table, where n is the number of sites.
However, these approaches test whether all sites are identical against the hypothesis that at least one of them is different. Is this a reasonable hypothesis? I would expect the locations to be different. The question is: are some locations more extremely different than others? To address this possibility, you could model the data with a beta binomial distribution: assume that each location has its own success probability, but these probabilities have a beta distribution. You can fit the model using R package bbmle. The vignette for that package contains a useful introduction to the betabinomial and a carefully worked example.
The beta distribution has two parameters, p and theta. p is the overall proportion and theta is a measure of dispersion -- or how different the locations can reasonably be expected to be. 
Once you have estimated the parameters of the beta binomial, you can determine which of your locations are outliers with respect to that distribution. Note that you can fit a beta-binomial with a different number of events for each location, as you have here.
If the beta-binomial is a good fit for your data, it will provide a more conservative model for the situation that you have than the binomial distribution. The beta-binomial allows that different locations may have slightly different success rates, but constrains those success rates to lie, typically, within a certain range. Only locations with success rates that are implausible with respect to the beta-binomial will be deemed outliers.
