I’m new to Bayesian statistics (self-studying), R and StackExchange. This forum has been extremely helpful for finding flaws in my reasoning. Is it all right if I ask for help in checking my logic for the question below? Are there any more explanations I should add? My solution matches one of the possible solutions, but I want to know whether my logic is correct and if I am explaining the steps in sufficient detail.
Question:
You decide to conduct a statistical analysis of a lottery to determine how many possible lottery combinations there were. If there are N possible lottery combinations, each person has a 1/N chance of winning. Suppose that 413,271,201 people played the lottery and three people won. You are told that the number of lottery combinations is a multiple of 100 million and less than 1 billion, but have no other prior information to go on. What is the posterior probability that there were fewer than 600 million lottery combinations?
My Solution:
Posterior
= P(Fewer than 600 million lottery combinations | 3 winners out of 413271201 players)
Prior (uniform) = 1/9
There are nine possible outcomes for N. We are counting in increments of 100 million, from 100 million to 900 million. Hence the Prior = 1/9
To find the Likelihood and Data, I use the dbinom function in R to calculate the probability of k successes for a binomial variable, given that the probability of success = 1/N.
Likelihood
= P(3 winners out of 413271201 players | Fewer than 600 million lottery combinations)
= dbinom(3,413271201,1/100000000) +
dbinom(3,413271201,1/200000000) +
dbinom(3,413271201,1/300000000) +
dbinom(3,413271201,1/400000000) +
dbinom(3,413271201,1/500000000)
= 0.5913931
Data
= 1/9 {
dbinom(3,413271201,1/100000000) +
dbinom(3,413271201,1/200000000) +
dbinom(3,413271201,1/300000000) +
dbinom(3,413271201,1/400000000) +
dbinom(3,413271201,1/500000000) +
dbinom(3,413271201,1/600000000) +
dbinom(3,413271201,1/700000000) +
dbinom(3,413271201,1/800000000) +
dbinom(3,413271201,1/900000000)
}
= 0.07351668
Hence, Posterior
= (Prior * Likelihood) / Data
= (1/9 * 0.5913931) / 0.07351668
= 0.894