Confidence intervals
A newspaper opinion poll before a general election asks about 1,000 people, not the whole country, yet it reports a margin of error for how every voter in Ireland thinks. How can that be justified? A survey, a quality check or a poll always works with a sample. Statistical inference is the bridge that goes from that sample data to a statement about the whole population, with an explicit margin of error and a confidence level that tells you how far you can trust that margin. We will come back to the poll at the end of the page.
The sample mean as a random variable
A social media analyst wants to study the daily time that Irish teenagers aged between 15 and 18 spend on TikTok*. To do so, they randomly select 400 users in this age…
A social media analyst wants to study the daily time that Irish teenagers aged between 15 and 18 spend on TikTok. To do so, they randomly select 400 users in this age group across the country and record their connection times.
Clearly identify the following elements of the statistical study:
- a) The population under study.
- b) The sample selected.
- c) The sample size.
- d) The statistic that would be calculated to summarise the information from the sample.
It is known that the waiting time in the queue of a popular theme park ride follows a normal distribution with a mean of $\mu = 45$ minutes and a standard deviation of…
It is known that the waiting time in the queue of a popular theme park ride follows a normal distribution with a mean of $\mu = 45$ minutes and a standard deviation of $\sigma = 12$ minutes.
If we choose a random sample of $n = 36$ visitors who have been on the ride:
-
What distribution does the sample mean $\bar{X}$ follow? State its mean and standard deviation (standard error).
-
Calculate the probability that the mean waiting time of this sample is greater than $48$ minutes.
Confidence interval for a mean
For another confidence level, find $z_{\alpha/2}$ in the normal tables: the table gives $P(Z In statistical inference, the critical value $z_{\alpha/2}$ is essential for determining the width of a confidence interval. It is the value of the standard normal distribution $N(0, 1)$ that leaves an area $\alpha/2$ to its right, where $1-\alpha$ is the confidence level (in the figure, the central area is $1-\alpha$ and each tail is $\alpha/2$). Using the standard normal distribution table $N(0, 1)$, find the critical values $z_{\alpha/2}$ corresponding to the following confidence levels: A courier company is studying the weight of packages it delivers in a city. The population is assumed to follow a normal distribution with a standard deviation of $\sigma = 0.8$ kg. A random sample of $n = 64$ packages is taken, obtaining a sample mean of $\bar{x} = 4.2$ kg. Calculate a confidence interval for the mean weight of all packages delivered by the company, using a confidence level of $95\%$. For a study on digital reading habits among young people, a confidence interval is to be constructed. Calculate, showing your working, the critical values $z_{\alpha/2}$ corresponding to the following confidence levels: Illustrate graphically the position of the critical value in a standard normal distribution for the $94 \%$ case.In statistical inference, the critical value $z_{\alpha/2}$ is essential for determining the width of a confidence interval. It is the value of the standard normal…
A courier company is studying the weight of packages it delivers in a city. The population is assumed to follow a normal distribution with a standard deviation of…
For a study on digital reading habits among young people, a confidence interval is to be constructed. Calculate, showing your working, the critical values $z_{\alpha/2}$…
Confidence interval for a proportion
In a secondary school, it is suspected that $15\%$ of the students are left-handed. A random sample of $n = 100$ students is selected to check this. 1. What distribution…
In a secondary school, it is suspected that $15\%$ of the students are left-handed. A random sample of $n = 100$ students is selected to check this.
-
What distribution does the sample proportion $\hat{p}$ of left-handed students follow? State its mean and standard deviation.
-
Calculate the probability that the proportion of left-handed students in the selected sample is less than $18\%$.
We wish to estimate the proportion of households in a city that separate organic waste for recycling. To do so, a random sample of $n = 400$ households is surveyed, of…
We wish to estimate the proportion of households in a city that separate organic waste for recycling. To do so, a random sample of $n = 400$ households is surveyed, of which $160$ state that they separate this waste.
Determine the confidence interval for the proportion of households that recycle organic waste across the whole city, using a confidence level of $90\%$.
In a survey carried out on $400$ students at a secondary school about the use of streaming platforms, $260$ said that they prefer watching TV series rather than films.…
In a survey carried out on $400$ students at a secondary school about the use of streaming platforms, $260$ said that they prefer watching TV series rather than films.
- a) Find the point estimate of the proportion of students who prefer series.
- b) Obtain a $97\,\%$ confidence interval for the true proportion of students who prefer series at that school.
Sample size and margin of error
For a proportion, the margin of error is at most $\dfrac{1}{\sqrt{n}}$ (the radius of the 95% interval in the worst case), as in the Leaving Cert specification.
A LED light bulb factory wishes to estimate the mean lifespan of its products. It is known from previous studies that the standard deviation of the lifespan is…
A LED light bulb factory wishes to estimate the mean lifespan of its products. It is known from previous studies that the standard deviation of the lifespan is $\sigma = 500$ hours.
If the quality control team wants to make an estimation with a confidence level of $95\%$, what minimum sample size $n$ should they choose so that the maximum error incurred is less than $100$ hours?
An estimate is to be made of the proportion of citizens who would be willing to use public transport if it were free. In a prior study the expected proportion is…
An estimate is to be made of the proportion of citizens who would be willing to use public transport if it were free. In a prior study the expected proportion is unknown, so maximum variance ($p = q = 0.5$) is assumed.
Determine the minimum sample size required to estimate this proportion with a maximum margin of error of $4 \%$ and a confidence level of $95.44 \%$ (which corresponds to a critical value of $z_{\alpha/2} = 2$).
A mobile phone company wants to estimate the proportion of teenagers who use "dark mode" on their devices at night. In an initial sample of $100$ users, $60\%$ confirmed…
A mobile phone company wants to estimate the proportion of teenagers who use "dark mode" on their devices at night. In an initial sample of $100$ users, $60\%$ confirmed using it.
- a) Calculate the $98\%$ confidence interval for the population proportion of users of this mode.
- b) Suppose that no prior information about the proportion is available (maximum uncertainty scenario). Determine the sample size needed for the maximum margin of error to be $0.02$ with a confidence level of $95\%$.
- c) If the proportion obtained in the initial sample ($0.6$) is used to calculate the sample size under the same conditions as in part b) (margin of error $0.02$ and confidence level $95\%$), how many fewer users would need to be surveyed compared to the maximum uncertainty scenario?
Relationship between confidence, error and sample size
The margin of error, the confidence level and the sample size are tied together: you cannot improve one without affecting another. Raising the confidence (more certainty) increases $z_{\alpha/2}$ and, all else being equal, widens the interval; the only way to gain precision without losing confidence is to increase $n$.
Two secondary schools, A and B, measure the mean time that their 2nd year Baccalaureate students spend studying mathematics per week. In both schools, it is known that…
Two secondary schools, A and B, measure the mean time that their 2nd year Baccalaureate students spend studying mathematics per week. In both schools, it is known that the population standard deviation is $1.5$ hours.
A sample of $100$ students is taken in each school. In school A, the confidence interval obtained for the mean has a width of $0.588$ hours. In school B, the confidence interval obtained for the mean is $(6.2; 7.2)$.
- a) Determine the confidence level used in school A.
- b) Determine the confidence level used in school B.
- c) Which of the two schools has made a more precise estimate? Justify your answer.
An "eco-friendly" clothing brand claims that $30\,\%$ of its customers are under $20$ years old. To check this, a random sample of $500$ customers is taken and it is…
An "eco-friendly" clothing brand claims that $30\,\%$ of its customers are under $20$ years old. To check this, a random sample of $500$ customers is taken and it is observed that $135$ of them are under $20$ years old.
- a) Construct a $99\,\%$ confidence interval for the proportion of customers under $20$ years old based on the sample data.
- b) In view of the result, can we consider the brand's claim to be consistent with the data obtained at a $99\,\%$ confidence level? Explain why.
The reaction time of pilots using a state-of-the-art flight simulator follows a normal distribution with unknown mean and standard deviation of $0.05$ seconds. On taking…
The reaction time of pilots using a state-of-the-art flight simulator follows a normal distribution with unknown mean and standard deviation of $0.05$ seconds. On taking a sample of $64$ pilots, a mean of $0.42$ seconds is observed.
- a) Obtain the confidence interval for the population mean at a confidence level of $97\%$.
- b) The simulator manufacturer claims that the mean reaction time is $0.40$ seconds. Is this claim compatible with the interval obtained in the previous part? Justify your answer based on the relationship between confidence intervals and population parameters.
- c) If it is decided to double the sample size and reduce the confidence level to $90\%$, how will this affect the width of the interval? Calculate the factor by which the width is reduced or increased.
Lab: intervals, simulation and decision-making
A fictitious survey by a county council randomly selects 400 households from a large population; 160 say they separate organic waste. Assume independent observations. Design the record sheet beforehand: population, sampling frame, selection, non-response, variable and confidence. A voluntary selection through a social network is not validated by calculating a narrow interval.
from math import sqrt, ceil
from statistics import NormalDist
from random import Random
normal = NormalDist()
n, successes, confidence = 400, 160, 0.90
p = successes/n
z = normal.inv_cdf((1+confidence)/2)
E = z*sqrt(p*(1-p)/n)
print('CI for proportion:', p-E, p+E)
print('n for error 0.04 at 95%:', ceil(normal.inv_cdf(.975)**2*.25/.04**2))
# Simulation of a CI for a mean with known sigma:
rng = Random(2026)
mu, sigma, size, repetitions = 50, 10, 25, 1000
margin = normal.inv_cdf(.975)*sigma/sqrt(size)
covered = 0
for _ in range(repetitions):
mean = sum(rng.gauss(mu,sigma) for _ in range(size))/size
covered += mean-margin <= mu <= mean+margin
print('Fraction of intervals that cover mu:', covered/repetitions)
Intervals change from sample to sample; the model parameter stays fixed:
Change $n$ and the confidence level, keeping the same observed proportion, and compare widths. Distinguish standard error from margin. For quantitative data, also calculate the mean and the sample standard deviation (with divisor $n-1$) using a spreadsheet: the latter estimates $\sigma$, but it does not automatically turn a normal interval into an exact one if $\sigma$ is unknown. Hand in the data, the procedure, the checks and the limits of the decision.