Link: Probability Statistical test

Calculate probability of binomial distribution

Binomial test

When we use a binomial distribution to calculate a P-value, it’s called a binomial test. It means that we would calculate the probability of this scenario, plus any other scenario that are equally rare or rarer.

Maximum likelihood in binomial distribution

When we want to know the likelihood, we simply swap the location of x and p in above equation on the left and the right side remains the same. In this way, we can change the p while x and n are fixed. e.g.

It means the likelihood of p=0.25 given that 4 out of 7 people would randomly prefer orange flavor is 0.058; as a comparison, the likelihood of p=0.5 is 0.273. As such, we can find different likelihood depends on p, and the Maximum likelihood is the peak value.

By doing the math for solve when the derivative is 0, we will get a value for:

This is the maximum likelihood estimate for p when there’s n trials and x successes, which is also the simple average.