Research Methods — Week 6
This week: the formal machinery. You’ll learn to run a t-test in R.
And then you’ll learn why it can mislead you.
Submit questions anonymously:
PollEv.com/geol
text geol to 07480 781235
🎓💻 Concept block 1
Compares two group means and asks:
“Is this difference larger than we’d expect by chance?”
🖥️ Switching to WebR
t = 2.34, df = 18, p-value = 0.031
95% CI: [0.12, 2.34]
| Element | Meaning |
|---|---|
| t-statistic | How many SEs apart are the means |
| p-value | How surprising, if H₀ is true |
| 95% CI | Plausible range for the true difference |
💬✏️ Exercise 1
I’m showing you R output from a t-test.
Write one sentence interpreting this result for a policy audience.
Then we’ll compare.
“p = 0.03 means there’s a 3% chance the null is true.”
Wrong. But extremely common. We’ll come back to this.
🎓 Concept block 2
For the t-test:
| Assumption | Check |
|---|---|
| Normality | Histogram, QQ plot, shapiro.test() |
| Equal variance | Side-by-side boxplots, Levene’s test |
| Independence | Think about the study design |
A skewed variable can produce misleading p-values.
HolmesCo
“Geological Solutions Since 2019”
Statistical Analysis — Soil Permeability
t-test on raw values: p = 0.04 → “Significant difference!”
t-test on log-transformed values: p = 0.23 → “No significant difference.”
The “significant” result was an artefact of skewness.
✏️💻 Exercise 2
Given a dataset:
t.test() before and after transformation🎓💬 Concept block 3
I’m going to show you why a statistically significant result can still be wrong most of the time.
Some of you simulated the Monty Hall problem in first-year Python.
Switching wins 2/3 of the time. But your gut says 50/50.
Why? Because your gut ignores the information the host gave you when they opened a door.
That confusion — between P(win) and P(win | what you now know) — is exactly what this block is about.
A disease affects 1 in 1,000 people.
A test is 99% accurate (99% sensitivity, 99% specificity).
You test positive.
What’s the probability you have the disease?
PollEv.com/geol
text geol to 07480 781235
Out of 100,000 people:
| Has disease | No disease | Total | |
|---|---|---|---|
| Test positive | 99 | 999 | 1,098 |
| Test negative | 1 | 98,901 | 98,902 |
| Total | 100 | 99,900 | 100,000 |
P(disease | positive) = 99 / 1,098 ≈ 9%
Not 99%. Nine percent.
Because the disease is rare.
The base rate matters enormously.
Even a very accurate test produces many false positives when the condition is uncommon.
HolmesCo
“Geological Solutions Since 2019”
Press Release — Major Gold Discovery in County Durham!
“Our geochemical assay (95% accuracy) detected gold in 50 out of 10,000 soil samples. Confirmed multi-element anomaly!”
Suppose 5 in 10,000 samples are actually gold-bearing.
| Gold present | No gold | Total | |
|---|---|---|---|
| Assay positive | ~5 | ~500 | ~505 |
| Assay negative | ~0 | ~9,495 | ~9,495 |
HolmesCo’s 50 positives? Almost certainly all false.
The press release is nonsense.
A p-value tells you: P(data | H₀)
How surprising is this data if the null is true?
What you actually want: P(H₀ | data)
How likely is the null to be true given this data?
These are not the same thing. The difference depends on the base rate.
✏️ Integrative exercise
Discuss with your group:
Write 3–4 sentences.
A t-test comparing two groups returns p = 0.04. Which statement is correct?
PollEv.com/geol
text geol to 07480 781235
Application session: “First tests”
You’ll run your first real tests on your project data.
Remember: a significant p-value is the start of the conversation, not the end.