ENVX1002 Statistics in Life and Environmental Sciences
The University of Sydney
Mar 2026
The Faculty has been informed of instances where students are being targeted by illegitimate academic services, which could potentially lead to plagiarism or other breaches.
This can include:
Engaging in such activities could constitute a breach of the Academic Integrity Policy and may result in penalties, including failing the assignment, the unit, or even a suspension or exclusion for misconduct.
We want you to do well on assessments. Contact the Learning Hub, your tutor, or Unit Coordinator to get support.
There are resources available to help you. Don’t be afraid to ask for help.

LO1. By the end of this course, students will be able to implement basic reproducible research practices—including consistent data organization, documented code, and version-controlled workflows—so that their statistical analyses and results can be readily replicated and validated by others.
LO2. By the end of this course, students will demonstrate proficiency in utilizing R and Excel to effectively explore and describe life science datasets.
LO3. By the end of this course, students will be able to apply parametric and non-parametric statistical inference methods to experimental and observational data using RStudio and effectively interpret and communicate the results in the context of the data.
LO4. By the end of this course, students will be able to put into practice both linear and non-linear models to describe relationships between variables using RStudio and Excel, demonstrating creativity in developing models that effectively represent complex data patterns.
LO5. By the end of this course, students will be able to articulate statistical and modelling results clearly and convincingly in both written reports and oral presentations, working effectively as an individual and collaboratively in a team, showcasing the ability to convey complex information to varied audiences.
Is our sample consistent with that claim, or is the difference too large to plausibly due to chance alone?
Is the mean TN concentration at this site equal to \(500 \mu g/L\), or is it different?

We will follow the steps in hypothesis testing
A useful acronym is HATPC:
For example
A test statistic measures how far the observed result is from what we would expect under the null hypothesis.
\(\text{Test statistic}=\frac{\text{Observed value - Expected value}}{\text{Standard error}}\)
This is essentially
\(=\frac{\text{Signal}}{\text{Noise}}\)
More formally:
So the p-value helps us judge whether the data are consistent with the null hypothesis.
What does this have to do with sampling distributions??
A useful memory aid is:
“If the P-value is low the Null hypothesis must go.”
But more formally:
Important:
Common mistakes
Controversy
At the end of a statistical test we write two conclusions
Suppose we want to compare a sample population or sample mean \((\mu)\) to a benchmark value \((c)\) - Could be our water quality benchmark of \(c=500 \mu g/L\)
\(H_0:\mu=c\) Two tailed
\(H_1:\mu \ne c\) Two tailed
\(H_0:\mu \ge c\) One tailed - less than
\(H_1:\mu < c\) One tailed - less than
\(H_0:\mu \le c\) One tailed - greater than
\(H_1:\mu > c\) One tailed - greater than
We usually use the first (two tailed) form unless we are specifically interested in testing whether the difference is in one direction because this is the only direction of interest
| Goal | Hypotheses | Tail |
|---|---|---|
| Detect unsafe water | H₀: μ ≤ c, H₁: μ > c | Right |
| Demonstrate safe water | H₀: μ ≥ c, H₁: μ < c | Left |
Rule: The tail follows the alternative hypothesis (H₁)
Type I error
Type II error
Note: Decreasing the significance level (\(\alpha\)) to say 0.01 will increase the probability of type II error
Power is the probability a test will detect a real effect when one exists.
In general:
The t-distribution is:
Its exact shape depends on the degrees of freedom

Suppose we wish to test whether the mean resting heart rate of ENVX1002 students differs from a benchmark value of 70 beats per minute (bpm).
We are going to do this exercise in class but I have provided a simulated example below so you have it in the slides as well.
We will simulate some data for 30 students in our ENVX1002 class. To do this we will draw 30 random numbers from a normal distribution with a mean of 70 and a standard deviation of 10.
State the Null and Alternate hypothesis!
\(H_0: \mu = 70 \text{ bpm}\) (Null hypothesis)
\(H_1: \mu \ne 70 \text{ bpm}\) (Alternate hypothesis)
Before applying a one-sample t-test, we should check whether the sample is approximately normally distributed. Consider the following:
| Sample size | Histogram | Q-Q plot | Jitter plot | Boxplot | Shapiro test |
|---|---|---|---|---|---|
| Small (n < 30) | Limited | Best | Very useful | Useful | Cautious use |
| Medium (30–100) | Useful | Very useful | Useful | Useful | Sometimes useful |
| Large (n > 100) | Useful | Best | Less useful | Good (outliers) | Too sensitive |
Rule of thumb:
- Small n: show the data (jitter) + Q-Q plot
- Larger n: histogram + Q-Q plot
- Use boxplots to highlight spread and outliers, not normality alone
We begin by looking at the data (EDA). Our sample size is 30 so we can look at the histogram, Q-Q plot and jitter plot.
library(ggplot2)
library(patchwork)
df <- data.frame(heart_rate)
p1 <- ggplot(df, aes(heart_rate)) +
geom_histogram(fill = "grey80", colour = "white", bins = 30) +
labs(title = "Histogram", x = "Heart rate", y = "Count") +
theme_minimal()
p2 <- ggplot(df, aes(sample = heart_rate)) +
stat_qq() +
stat_qq_line(colour = "red") +
labs(title = "Q-Q plot", x = "Theoretical", y = "Sample") +
theme_minimal()
p1 + p2As an option, we can also use the Shapiro-Wilk test as a supporting check. Best if the sample size is less than 50.
For a one-sample t-test, the test statistic is:
\(t = \frac{\bar{y} - \mu}{s/\sqrt{n}}\)
where:
CI & T-Statistic & P-value
In R, the one-sample t-test gives us:
We can see the following output:
Because (p = 0.8015 > 0.05), we fail to reject the null hypothesis.
The data do not provide strong evidence that the mean resting heart rate of ENVX1002 students differs from 70 bpm.
Also note: - 70 bpm lies within the 95% confidence interval - this is consistent with the non-significant test result
A confidence interval gives a range of plausible values for an unknown population parameter.
Many people prefer confidence intervals because they show:
A hypothesis test gives a decision about a claim. A confidence interval gives a plausible range.
\(CI = \bar{y} \pm Z_{\alpha/2} \cdot \frac{\sigma}{\sqrt{n}}\)
for the 95% confidence interval, \(\alpha = 0.05\) and \(Z_{\alpha/2} = 1.96\) i.e. 2 standard errors from the mean.
In practice, we usually do not know the population variance.
In that case, we use the t-distribution:
\(CI = \bar{y} \pm t_{\alpha/2,df}\frac{s}{\sqrt{n}}\)
where:
Depiction of confidence intervals from each of 100 simulated samples
Let’s look at our water quality example again:
State Hypothesis

Check assumptions
What do we notice about the plots? Does the data look normally distributed? Do we see strong skewness or outliers?
library(ggplot2)
library(gridExtra)
# Histogram
p1 <- ggplot(TN, aes(x = TN)) +
geom_histogram(
fill = "blue", color = "black",
bins = 7
) +
xlab("Total Nitrogen (ug/L)") +
theme_minimal()
# Boxplot
p2 <- ggplot(TN, aes(x = TN)) +
geom_boxplot(fill = "blue") +
xlab("Total Nitrogen (ug/L)") +
theme_minimal()
# Q-Q plot
p3 <- ggplot(TN, aes(sample = TN)) +
stat_qq() +
stat_qq_line(col = "red") +
theme_minimal()Shapiro-Wilk normality test
For right (positive) skewed data, we can use a
For left (negative) skewed data (which is rare to find), we can “try” a
Let’s try a log10 transformation:
library(ggplot2)
library(gridExtra)
# Histogram
p1 <- ggplot(TN, aes(x = log10_TN)) +
geom_histogram(
fill = "blue", color = "black",
bins = 7
) +
xlab("Log10 Total Nitrogen (ug/L)") +
theme_minimal()
# Boxplot
p2 <- ggplot(TN, aes(x = log10_TN)) +
geom_boxplot(fill = "blue") +
xlab("log10 Total Nitrogen (ug/L)") +
theme_minimal()
# Q-Q plot
p3 <- ggplot(TN, aes(sample = log10_TN)) +
stat_qq() +
stat_qq_line(col = "red") +
theme_minimal()Shapiro-Wilk normality test
Shapiro-Wilk normality test
data: TN$log10_TN
W = 0.97279, p-value = 0.6375
We will also need to transform the hypothesised mean of 500 to the log10 scale.
\(H_0: \mu = \log_{10}(500)\) \(\mu g/L\) (Null hypothesis)
\(H_1: \mu \ne \log_{10}(500)\) \(\mu g/L\) (Alternate hypothesis)
One Sample t-test
data: TN$log10_TN
t = 4.8768, df = 28, p-value = 3.884e-05
alternative hypothesis: true mean is not equal to 2.69897
95 percent confidence interval:
2.807748 2.965309
sample estimates:
mean of x
2.886528
Geometric mean
Note that now we are looking at the geometric mean as opposed the the arithmetic mean which was 855.86 in our case
Confidence intervals
\(10^{CI_{low}}\) and \(10^{CI_{high}}\)
Detect unsafe water | H₀: μ ≤ 500, H₁: μ > 500 |
OR
Detect unsafe water | H₀: μ ≤ \(\log_{10}(500)\), H₁: μ > \(\log_{10}(500)\) |
One Sample t-test
data: TN$log10_TN
t = 4.8768, df = 28, p-value = 1.942e-05
alternative hypothesis: true mean is greater than 2.69897
95 percent confidence interval:
2.821104 Inf
sample estimates:
mean of x
2.886528
This presentation is based on the SOLES Quarto reveal.js template and is licensed under a Creative Commons Attribution 4.0 International License.