Back to RStudio and Project Skills

Higher Applications of Mathematics

Hypothesis testing in RStudio

Running tests and interpreting p-values.

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 using p-values to judge evidence against a claim. 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, mu = value)
  • 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

Hypothesis test output

A paired test compares typing speeds before and after a short training session.

Simulated output

> t.test(after, before, paired = TRUE)
t = 2.41, df = 17, p-value = 0.028
alternative hypothesis: true mean difference is not equal to 0
95 percent confidence interval:
  1.2  8.7

p-value = 0.028

0.028 is less than 0.05

Statistically significant evidence at the 5% level

p-value

0.028

Less than 0.05, so there is statistically significant evidence at the 5% level.

Test type

Paired

The same people were measured before and after.

Conclusion

Evidence of change

Use evidence language rather than proof language.

What it means

Because p = 0.028 is below 0.05, the output supports a statistically significant change in mean typing speed at the 5% level.

What to write

At the 5% significance level, there is statistically significant evidence that the training changed mean typing speed. The paired design is appropriate because the same people were measured before and after.

Weak answer: The training is proven to work for everyone.

Watch out

Do not use proof language. A small p-value supports evidence for a difference; it does not prove the claim for every person.

At the 5% level, what should you decide from p = 0.028?

Choose an option, then check the feedback.

Worked examples

Walkthrough 1

Run the command

A pupil is using RStudio for using p-values to judge evidence against a claim 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, mu = value)

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.

A small p-value suggests the data would be unusual if the null claim were true.

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