# Probability of random events

I am doing this probability exercise, and not understanding the answer provided in the textbook.

The question is

'Kevin buys a box of 100 apples. He draws an apple randomly from the box and puts it back after recording whether it is rotten. After 50 draws, 3 apples drawn are rotten. Estimate the probability that an apple randomly drawn from this box is in good condition.'

• I'm not sure a rigorous answer to this will be any more intuitive than the simple, non-rigorous answer: the fraction of apples in good condition in the samples is an estimate of the fraction of apples in good condition in the box itself. We can go into details with the binomial distribution and so on, but I don't know how much it would help.
– Ian
Nov 29, 2015 at 17:11
• In this case it is a random sample. If he had done this a two thousand times and gotten an 120 rotten apples we'd assume the the probability of rotten apples is 120 out of 2,000 (3 out of 50) [and good apples 1880 out of 2,000]. If we didn't replace the apples we'd have to take dependent conditions of lack of replacement into account. But with replacement each sample is simply random and we assume it is representative of actual probability. Nov 29, 2015 at 17:18
• No binomial, it is a junior secondary school question:-) Nov 29, 2015 at 17:32
• @fleablood Even if sampling was done without replacement, sample proportion would be an unbiased estimator of population proportion - only with smaller variance compared to sampling with replacement.
– A.S.
Nov 29, 2015 at 19:14

Turned out to be a long answer. The outline is:

(1) What are we trying to do with sampling?

(2) Tool #1: Bernoulli random variable (generalized coin flip)

(3) Tool #2: Expected value

(4) Tool #3: Unbiased estimators

(1) By sampling, we are trying to discover an unknown parameter, the proportion of good apples in the box -- call it $p$. Put another way, if we are drawing (and putting back into the box after each draw) a random apple and defining a good apple draw as a success, each draw has probability $p$ of success.

Note that we could find $p$ directly by looking through all the apples at once and counting the rotten ones. Then $p=\frac{\text{Number of good apples}}{100}.$ But we are trying to guess at $p$ indirectly by sampling. The idea is to come up with a formula that will "reliably" give us the correct answer with a "large enough" sample.

(2) It will be helpful to introduce a concept called a Bernoulli random variable. This is essentially a way to describe coin flip with probabilities other than 1/2 of getting heads. Lets say flipping heads is a success, tails is failure. Suppose the coin is not necessarily fair, and has probability $p$ of heads, $1-p$ of tails. We could describe this coin by a random variable $X=1$ with probability $p$, $X=0$ with probability $1-p$. We could describe the 6th flip of this coin by $X_6=1$ with probability $p$, $X_6=0$ with probability $1-p$ since it's the same coin and probabilities don't change over time. Similarly, we could describe the kth coin flip with $X_k=1$ with probability $p$, $X_k=0$ with probability $1-p$. Notice that in our situation, we can consider the kth draw of an apple to be a Bernoulli random variable with parameter p, i.e. $X_k=1$ with probability $p$, $X_k=0$ with probability $1-p$.

(3) Next, we introduce the idea of expected value. This is just an idea of weighted averages: Given possible values of a random variable and probabilities for each possibility, we define the expected value to be the sum of the the possible values weighted by the probabilities. (Example: X=1 with probability 1/3, X=2 with probability 1/3, X=3 with probability 1/3. Then expected value of X is $E[X]=1/3 * 1 + 1/3 * 2 + 1/3 * 3=2$.) Notice that the expected value of a Bernoulli random variable is just the probability of success, p. We will use this fact in (4).

(4) Lastly, we consider the idea of estimators and unbiased estimators. Let $\hat p=\frac{\text{Number of good apples drawn}}{\text{Number of total apples drawn}}=\frac{1}{n}\sum_{k=1}^n X_k$ . Call this our estimator. An estimator is called unbiased if the expected value of the estimator is the same as the value of the true parameter (here, the proportion of good apples). Expected value can be interchanged with sums and the expected value of a constant is just that constant, so $E[\hat p]=E[\frac{1}{n}\sum_{k=1}^n X_k]=\frac{1}{n}\sum_{k=1}^n E[X_k]=\frac{1}{n}\sum_{k=1}^n p=\frac{1}{n} *np=p$. So $\hat p$ is an unbiased estimator for the true proportion of good apples! This means we can use it as a good estimate, given a random sample.

So the question could be interpreted as "Find an unbiased estimator for the true proportion of good apples, and tell me what the value of that estimator is, given the random sample of 47 good and 3 rotten."

• Perhaps Kevin used a maximum likelihood estimate, or used a Bayesian estimate with an improper Beta$(0,0)$ prior Mar 16, 2017 at 1:20