Lecture notes. Written from the material of GTPB Psls20, licensed CC BY 4.0. These are notes, not a transcript: the material has been reorganised and rewritten. This adaptation carries the same licence, and the original is linked above.
23. Smelly Armpit Data Exploration¶
What this covers¶
A hypothesis test comes with assumptions, and you don't get to skip checking them just because the
test itself is the interesting part. This chapter works through the "smelly armpit" dataset — a
small randomized experiment on the armpit microbiome — as an exercise in data exploration: what
to plot, what to compute, and what question each of those answers, before any formal test is run.
It assumes you can manipulate a data frame with dplyr-style piping (group_by, summarize,
mutate) and that you know roughly what a two-sample comparison of means is trying to do; the test
itself is deferred to the next tutorial.
The experiment behind the data¶
A smelly armpit is not caused by sweat itself. Sweat is odourless; the smell comes from specific bacteria that metabolise it into smelly compounds, chiefly Corynebacterium spp. A second group of bacteria, Staphylococcus spp., is also abundant in the armpit microbiome but does not turn sweat into odour. So the balance between the two genera is a plausible handle on how smelly an armpit is: the more the microbiome is dominated by Staphylococcus relative to Corynebacterium, the less odour-producing capacity it has.
A research group at Ghent University (the CMET group) tested whether that balance can be shifted on purpose, as a therapy for smelly armpits:
- wipe out the existing armpit microbiome with antibiotics;
- reintroduce a different microbiome by microbial transplant.
The experiment: 20 students with smelly armpits were randomized into two treatment arms — a placebo arm (antibiotics only) and a transplant arm (antibiotics followed by a microbial transplant). Six weeks after treatment, the armpit microbiome was sampled and the relative abundance of Staphylococcus spp. — its share of Staphylococcus spp. plus Corynebacterium spp. — was measured by DGGE (Denaturing Gradient Gel Electrophoresis). The question the researchers wanted answered: does the transplant shift that relative abundance, compared with antibiotics alone?
Why explore the data before testing it¶
The formal comparison of the two groups is left to the next tutorial, but it comes with a cost: to be valid, a standard two-sample test needs
- the data within each treatment group to be roughly normally distributed, and
- the two groups to have roughly the same variance.
These are not things you assume and hope; they are things you check, and the way you check them is exploration — plotting the data and summarizing it numerically — before the test is run. If either assumption looks badly wrong, that is information the downstream analysis needs, not something to discover after the fact. Mastering that exploration step, on this dataset, is the point of the tutorial.
Looking at the shape: histograms and boxplots¶
The first plot to make is a histogram of the relative abundance (rel), with one row per treatment
group (trt) so the two distributions sit directly above one another for comparison. From that plot
it looks like relative abundance is higher in the students who received the transplant.
But with only 20 students split across two arms — about ten per group — a histogram is a genuinely noisy way to see a distribution's shape: each bar is counting very few points, and where the bin edges happen to fall can make the same data look lumpy or smooth. A boxplot is a better choice at this sample size, because it summarizes the data directly (median, interquartile range, whiskers) rather than routing it through an arbitrary binning. Plotting relative abundance against treatment as a boxplot is what to look at instead — and what to look for is whether the two boxes overlap, whether their spreads (box heights) are comparable, which speaks directly to the equal-variance assumption, and whether either group shows a skew or an outlier that would threaten the normality assumption.
Turning the picture into numbers¶
A plot gives a qualitative read; the exploration also needs numbers that the next tutorial's test will actually use. For each treatment group, compute:
- the mean relative abundance,
- the standard deviation, a measure of spread within the group — this is the number that directly checks the equal-variance assumption between the two groups,
- n, the number of observations in the group, and
- the standard error of the mean, $\(SE = \frac{s}{\sqrt{n}},\)$ which will set the scale of uncertainty for whatever comparison of the two group means comes next.
The natural pipeline for this is the one the tutorial sets up: group the data by treatment
(group_by(trt)), summarize the rel variable within each group to get the mean, standard
deviation and count, then add a derived column for the standard error from those. Nothing here is
new statistics — it is the same three numbers (mean, spread, sample size) that any exploration of a
grouped variable needs, made specific to this dataset.
Exercises¶
The dataset is a data frame ap with (at least) a treatment column trt (placebo vs. transplant)
and a relative-abundance column rel.
- Load the dataset into
apand inspect it withglimpse(). What are the variables, and what type is each one held as? - Plot a histogram of
rel, coloured bytrt, with the two treatment groups shown as separate rows (one histogram per group, stacked vertically). What does the plot suggest about the effect of the transplant? - Explain, given the sample size, why a boxplot might be more informative here than a histogram, and produce one: relative abundance on one axis, treatment group on the other, coloured by treatment. What do you observe?
- Group the data by treatment and compute, for each group, the mean, standard deviation and number
of observations of
rel; then add a column for the standard error of the mean. Which of the two assumptions listed above (normality within groups, equal variance across groups) does each of these numbers or plots speak to?
Sources¶
- Both parts of this chapter are drawn from the GTPB PSLS20 tutorial Data exploration: armpit
microbiome, converted from
Data_exploration_armpit.Rmd(CC BY 4.0): - the dataset and experimental design —
01-smelly-armpit-dataset.md - the visualization and descriptive-statistics workflow —
02-data-visualization.md - The source is itself a fill-in-the-blank R exercise: the code that actually loads
ap, the exactggplotcalls for the histogram and boxplot, and thesummarize_at/mutatepipeline for the descriptive statistics are left as blanks for the student to complete, so no filled-in code or solved output is reproduced here — see the Exercises section above for the tasks themselves. - The tutorial links to a video on the proposed microbial-transplant therapy
(
https://youtu.be/9RIFyqLXdVw) without summarizing it; that content is not included here. - The formal test of the treatment effect, and its own assumption checks, are deferred by the source to a following tutorial on hypothesis testing, which was not supplied.
← 22. Breast Cancer Dataset · Contents · 24. Visualizing Paired Data →