Back to RStudio and Project Skills

Higher Applications of Mathematics

Confidence intervals in RStudio

Producing intervals and explaining meaning.

Before you start

  • Know the statistical question you are trying to answer.
  • Check that variables are named clearly and measured in suitable units.
  • Be ready to write an interpretation, not just copy RStudio output.

Method chooser

Which RStudio method do I use?

RStudio lesson

Key idea

  • This topic focuses on estimating a population value from sample data. In Higher Applications, RStudio is used as a practical tool to calculate, graph and test ideas from data.
  • A strong answer shows what command was used, what output was produced, and what that output means in context. Use careful language such as 'This suggests...' or 'There is evidence to suggest...'.

Key commands and skills

  • t.test(x)$conf.int
  • names(data)
  • summary(data)
  • Use comments in scripts with # to explain your steps.

Technology output practice

Output interpretation preview

Read the simulated output, pick out the key value, then turn it into a written conclusion. This is a learning preview, not a real RStudio environment.

Context

Confidence interval output

A sample is used to estimate the mean waiting time at a clinic.

Simulated output

> t.test(waiting$minutes)
95 percent confidence interval:
  21.4  28.6
sample mean
  25.0
202530

95% CI: 21.4 to 28.6 minutes

Sample mean

25.0 min

The mean waiting time in the sample.

Interval

21.4 to 28.6 min

A plausible range for the population mean, using this method.

Confidence level

95%

Use the confidence level in the interpretation, not as a guarantee for one person.

What it means

The interval gives a range of plausible values for the population mean waiting time. It is not a range for every individual waiting time.

What to write

Using this sample, a 95% confidence interval for the mean waiting time is 21.4 to 28.6 minutes. This suggests the true mean waiting time is likely to be in that range.

Weak answer: 95% of people waited between 21.4 and 28.6 minutes.

Watch out

Remember that a confidence interval for a mean is not the spread of individual data values.

What does the interval describe?

Choose an option, then check the feedback.

Worked examples

Walkthrough 1

Run the command

A pupil is using RStudio for estimating a population value from sample data with a small school-friendly data set.

  1. Load or identify the data frame.
  2. Check the exact column names with names(data).
  3. Run the key command: t.test(x)$conf.int

The output should be checked against the variables and the original question.

Walkthrough 2

Read the output

RStudio has produced numerical or graphical output.

  1. Find the key value, graph feature or p-value.
  2. Check the unit and variable name.
  3. Avoid copying every line of output into the conclusion.

The interval gives plausible values for the population mean.

Walkthrough 3

Write the interpretation

The result must be used in a project conclusion.

  1. Start with a cautious phrase such as 'This suggests...'.
  2. Refer to the context and variables.
  3. Mention a limitation if the data set is small, biased or observational.

The conclusion should be clear, cautious and linked to evidence.

Watch out

  • Misspelling a data frame or column name.
  • Forgetting brackets or quotation marks in a command.
  • Copying output without explaining what it means.
  • Claiming causation from correlation.
  • Using strong language such as 'proves' when the data only suggests evidence.

Statistics connection

Related Statistics topics

Next step

Move into practice

Use the learning notes to read output tables carefully, then try varied summary, correlation, regression and test-output interpretation.

RStudio mixed quiz