This is a new teaching example written for this portfolio. It illustrates how I connect a calculation to an explanation; it is not a historical assignment or student work.
Start with a question
Two small, synthetic sets of plant heights have the same average. Does that make them interchangeable?
| Group | Heights (arbitrary units) | Mean | Sample standard deviation |
|---|---|---|---|
| A | 9, 10, 11 | 10 | 1 |
| B | 1, 10, 19 | 10 | 9 |
Both means are 10. Group B is much more spread out. Reporting only the average hides that difference. Three observations per group are enough to illustrate the calculation; they are not a basis for a scientific treatment-effect claim.
Make the answer runnable
a <- c(9, 10, 11)
b <- c(1, 10, 19)
rbind(
A = c(mean = mean(a), sample_sd = sd(a)),
B = c(mean = mean(b), sample_sd = sd(b))
)
# Draw each observation before interpreting a summary.
stripchart(list(A = a, B = b), method = "stack",
vertical = FALSE, xlab = "Synthetic height")
Then change one thing
Replace 19 with 40 in Group B. Before running the code, predict which summaries will change and in which direction. Then compare the prediction with the output. The point is to connect the function call to the property it measures.
Ask what is still missing
Where did the measurements come from? Were the groups sampled comparably? Are these independent observations? What decision would the difference support?
A working program answers the calculation. It does not supply an experimental design. That distinction is part of what I want learners to understand.
The connection to my teaching
My introductory R teaching included a six-week applied statistical-analysis project. This new example shows the same kind of progression: pose a question, inspect the data, calculate, visualize, and explain what the result does and does not establish.