Back to homeMathematics · 5th Year HL · Change subject
Start for free
5th Year HL · Mathematics
Functions, Induction and Further Trigonometry · Hypothesis testing and expected value

p-values and expected value

At the table quiz night in your local GAA club, someone is selling raffle tickets at €2 each. Should you buy one? And if the club says "this coin always lands heads half the time", how many heads in a row would make you stop believing them? Both questions are answered with probability: the first with expected value, the second with a p-value.

Expected value of a random variable

A random variable $X$ is a number that depends on the outcome of an experiment. For a die, $X$ is the score. For a raffle ticket, $X$ is the prize it wins.

If you repeat the experiment many times, the average of the results settles down to a fixed number. That number is the expected value (or mean) of $X$.

Why does this work? It is a weighted average. Each value counts in proportion to how often it turns up.

Roll the die many times and watch the average of the scores. It heads towards 3.5, even though you can never roll a 3.5.

Practice★☆☆Not started
A fair six-sided die is rolled once. Let $X$ be the score. Calculate the expected value $E(X)$.

A fair six-sided die is rolled once. Let $X$ be the score. Calculate the expected value $E(X)$.

Solve
Practice★☆☆Not started
A raffle in a Limerick GAA club sells 200 tickets at €2 each. There is one prize of €100 and two prizes of €25. Find the expected prize value of one ticket and the…

A raffle in a Limerick GAA club sells 200 tickets at €2 each. There is one prize of €100 and two prizes of €25. Find the expected prize value of one ticket and the expected profit of a ticket holder.

Solve

Fair games and decisions

When you pay to play, what matters is the expected profit:

$$\text{expected profit} = E(\text{winnings}) - \text{cost to play}.$$

Why? Over many plays the player's average profit per game approaches the expected profit. A positive value means the player wins in the long run, and a negative value means the organiser does.

When the winnings depend on how long a game lasts, build a table of outcomes and probabilities first, then use $E(X) = \sum xP(x)$. Always check that the probabilities add to 1.

Practice★★☆Not started
A game at a fundraiser in Sligo costs €3 to play. A player rolls two fair dice and wins €12 if the total is 7, €5 if the total is 11 or 12, and nothing otherwise. a)…

A game at a fundraiser in Sligo costs €3 to play. A player rolls two fair dice and wins €12 if the total is 7, €5 if the total is 11 or 12, and nothing otherwise.

  1. a) Find the probability of each outcome.
  2. b) Find the expected winnings and expected profit per game.
  3. c) Should the organisers expect to make a profit? Explain.
Solve
Practice★★★Not started
A player pays €$c$ to play a game: a fair coin is tossed until the first head appears, at most 4 tosses. If the first head occurs on toss $k$, the player wins €$2^k$; if…

A player pays €$c$ to play a game: a fair coin is tossed until the first head appears, at most 4 tosses. If the first head occurs on toss $k$, the player wins €$2^k$; if no head appears in 4 tosses, the player wins nothing.

  1. a) Find the probability distribution of the winnings.
  2. b) Find the expected winnings.
  3. c) Find the value of $c$ that makes the game fair, and determine whether the game favours the player when $c = 3$.
Solve

Variance and standard deviation of $X$

Two games can have the same expected value but very different risk. A game that always pays €1 is very different from one that pays €100 with probability 0.01 and €0 otherwise. We measure the spread with the variance and standard deviation.

The variance is the average squared distance from the mean, $E\big[(X-\mu)^2\big]$, and the formula above is a quicker way to calculate it.

Bar chart of P(X = x) = x squared over 14 for x equal to 1, 2 and 3, with heights 1/14, 4/14 and 9/14. x = 1 x = 2 x = 3 1/14 4/14 9/14

Many independent plays

If you play the same game $n$ times, with the plays independent, then for the total $T$:

$$E(T) = nE(X), \qquad \text{Var}(T) = n\,\text{Var}(X), \qquad \sigma_T = \sqrt{n}\,\sigma.$$

Adding or subtracting a fixed amount (such as the cost of a ticket) changes the mean but not the spread.

Practice★★☆Not started
The random variable $X$ has the probability distribution $P(X=x)=kx$ for $x = 1,2,3,4$. a) Find the value of $k$. b) Calculate $E(X)$. c) Calculate $E(X^2)$ and the…

The random variable $X$ has the probability distribution $P(X=x)=kx$ for $x = 1,2,3,4$.

  1. a) Find the value of $k$.
  2. b) Calculate $E(X)$.
  3. c) Calculate $E(X^2)$ and the variance of $X$.
Solve
Practice★★★Not started
A company in Dublin offers an insurance policy for €80 per year. The probability of a claim of €500 is 0.1 and of a claim of €2,000 is 0.02; otherwise no claim is made.…

A company in Dublin offers an insurance policy for €80 per year. The probability of a claim of €500 is 0.1 and of a claim of €2,000 is 0.02; otherwise no claim is made.

  1. a) Find the expected payout and the company's expected profit per policy.
  2. b) Find the standard deviation of the payout.
  3. c) For 1,000 independent policies, find the expected total profit and the standard deviation of the total profit, and hence comment on the company's risk.
Solve

p-values and hypothesis tests

Suppose a coin is tossed 12 times and gives 10 heads. Is the coin fair? Even a fair coin can give 10 heads occasionally. The question is how unlikely such a result is.

A hypothesis test works like a court case. We start by assuming the claim is true, then ask whether the data are too surprising to accept it.

"At least as extreme" points in the direction of $H_1$. If $H_1: p > 0.5$, a high number of heads is extreme, so we use $P(X \ge \text{observed})$. If $H1: p < p_0$, we use $P(X \le \text{observed})$. For a two-tailed test, we double the one-tailed probability.

Bar chart of the binomial distribution B(12, 0.5) with the bars for 10, 11 and 12 heads shaded to show the p-value. 012 345 678 91011 12 p-value number of heads

A Type I error means rejecting $H_0$ when it is actually true. Its probability is the significance level. Using 1% instead of 5% makes this error less likely, but makes it harder to detect a real difference.

Back to the start: if the club's coin showed 12 heads in a row, then $P(X \ge 12) = \frac{1}{4096}$, far below 5% and 1%, so you would be right to doubt the claim.

Practice★☆☆Not started
A coin is tossed 10 times and gives 9 heads. Assuming the coin is fair, find the probability of obtaining 9 or more heads. Give your answer to 4 decimal places.

A coin is tossed 10 times and gives 9 heads. Assuming the coin is fair, find the probability of obtaining 9 or more heads. Give your answer to 4 decimal places.

Solve
Practice★★☆Not started
A manufacturer in Waterford claims that 90% of its light bulbs last more than 1,000 hours. A sample of 20 bulbs is tested and 15 last more than 1,000 hours. a) State…

A manufacturer in Waterford claims that 90% of its light bulbs last more than 1,000 hours. A sample of 20 bulbs is tested and 15 last more than 1,000 hours.

  1. a) State suitable null and alternative hypotheses.
  2. b) Find the p-value, $P(X\le 15)$, where $X\sim B(20, 0.9)$, to 4 decimal places.
  3. c) State your conclusion at the 5% significance level.
Solve

Large samples: the normal approximation

For a large sample, adding up many binomial terms is slow. If $X \sim B(n, p)$ with $n$ large, we can use a normal distribution with

$$\mu = np, \qquad \sigma = \sqrt{np(1-p)}.$$

Because $X$ takes whole numbers but the normal distribution is continuous, we use a continuity correction: "$X \ge 60$" becomes "$Y > 59.5$", because the whole number 60 occupies the interval 59.5 to 60.5.

Normal curve with the upper tail beyond 59.5 shaded to show the p-value for a binomial test. mean 50 59.5 p-value
Practice★★★Not started
A school in Kilkenny claims that a student chosen at random has probability 0.3 of cycling to school. In a random sample of 50 students, 24 cycle. a) State the…

A school in Kilkenny claims that a student chosen at random has probability 0.3 of cycling to school. In a random sample of 50 students, 24 cycle.

  1. a) State the hypotheses for a test of whether the true proportion is greater than 0.3.
  2. b) Using a normal approximation to $B(50, 0.3)$ with continuity correction, find the p-value.
  3. c) State and justify your conclusion at the 1% level, and explain what a Type I error would mean here.
Solve

Summary

  • $E(X) = \sum xP(x)$, a weighted average. $E(X^2) = \sum x^2P(x)$. Probabilities always add to 1.

  • $\text{Var}(X) = E(X^2) - \mu^2$ and $\sigma = \sqrt{\text{Var}(X)}$. For $n$ independent plays, the mean is $n\mu$ and the standard deviation is $\sqrt{n}\,\sigma$.

  • A game is fair if the expected profit is 0, that is, the cost equals $E(\text{winnings})$.

  • A p-value is the probability, assuming $H_0$ is true, of a result at least as extreme as the one observed. If p-value < significance level, reject $H_0$.

  • For a large sample, use $N(np, np(1-p))$ with a continuity correction.

  • A Type I error means rejecting $H_0$ when it is true.

See all the exercises in this section