Chapter 13: Making the call
Listen in Dr. Leith’s voice
Chapter 12 ended on a number and a doubt. The number was a gap: across the sample, gaming channels averaged 28.49 characters per chat message and non-gaming channels 33.70, a difference of a little over five characters. The doubt was whether that gap means anything.
The doubt is not idle. A sample almost always shows some gap. Split any group of people in two at random, measure their heights, and the two averages will differ a little, not because the halves are truly different but because no two samples come out identically. The five-character gap between gaming and non-gaming chat could be a real difference between the two kinds of channel. It could also be the ordinary wobble that any two samples produce. Looking at the histogram cannot tell the two apart, because both possibilities produce a gap.
Settling that doubt is the job of inferential statistics, and it is the work of this chapter. The chapter’s title names what is at stake. After describing a sample, a researcher eventually has to make a call: is the pattern in the data a real feature of the world, or is it noise that will not survive the next sample? Chapter 13 is where the chat study makes that call about its central finding.
What a test actually asks
Start with what the question really is. The study did not measure those 34,762 messages because anyone cares about those particular messages. It measured them to learn something about gaming and non-gaming chat in general, the broad populations the sample stands in for. The sample is a means; the population is the point. And a sample, however carefully drawn, is not the population. It is a partial view, and partial views are noisy.
So the honest question is not “is there a gap in the sample,” because there plainly is. It is “is the gap in the sample large enough that chance alone is an unconvincing explanation for it.” That is the question a hypothesis test answers, and it answers it through a move that feels backward the first time.
The test does not start from the difference you suspect is real. It starts from its opposite, called the null hypothesis: the assumption that there is no real difference at all, that gaming and non-gaming chat have the same true mean length, and that the five-character gap is nothing but sampling noise. The test then asks a single question of the data: if the null hypothesis were true, how surprising would a gap this large be?
The logic is the logic of a skeptic. Imagine testing whether a coin is weighted by flipping it a hundred times. You would not try to prove it crooked directly. You would assume it fair, the null hypothesis, work out how often a fair coin would produce a result as lopsided as the one you got, and if that turned out to be a rare event, conclude that the fair-coin assumption is hard to believe. A hypothesis test treats the chat data the same way. Assume nothing is going on, measure how surprising the data are under that assumption, and if they are surprising enough, reject the assumption.
Choosing the test
There is not one hypothesis test. There are many, and which one applies depends on the kind of data in hand. This is where the measurement levels from Chapter 8, the nominal, ordinal, interval, and ratio distinctions, stop being vocabulary and start doing work.
The chat study’s question pairs one continuous variable with one categorical split. Message length is a ratio variable, an exact count of characters. Gaming status is a nominal variable with two values, gaming and non-gaming. A continuous outcome compared across two groups is the textbook setting for the t-test, and that is the test this chapter runs.
A different question would call for a different test, and three tests cover almost every question a first study asks. The variables choose the test:
| Your question pairs | The test | What it reports |
|---|---|---|
| Two categorical variables (gaming status by whether a message carries an at-mention) | Chi-square test of independence, chisq.test() |
Whether the two are associated, and Cramer’s V for how strongly |
| One two-group categorical variable and one continuous variable (gaming status by message length) | Independent t-test, t.test() |
Whether the group means differ, and Cohen’s d for by how much |
| Two continuous variables (a channel’s message count by its mean message length) | Pearson correlation, cor.test() |
Whether the two move together, and r for how strongly |
The R Companion (the AURA Lab R Companion icon on VS Code’s left edge) has a command, AURA: Check my test choice, that checks a test you have already chosen against this table; it does not choose for you.
Pick the row that matches your variables, and write one sentence saying why that test and not another: a chi-square on message length would mean binning a count into categories and throwing away most of what was measured, and a t-test on two continuous variables would mean splitting one of them into two groups at an arbitrary line. Naming the test you rejected and why is how a reader knows the choice was made rather than defaulted. A test applied to the wrong kind of data produces a number, and the number is meaningless. This chapter runs the t-test on the study’s central question and then shows the other two on questions the same data can answer.
One more thing comes before the code. State the hypothesis in plain words, naming the two variables and the relationship you expect, and state it as an association: “Message length is associated with whether a channel is gaming or non-gaming, with non-gaming messages running longer.” Not “gaming makes messages shorter,” because nothing in this design can show what makes anything; the study observes two variables and asks whether they go together. A hypothesis written before the code is a commitment. One written after the results is a description of them.
The R Companion, the course’s extension for VS Code, writes code blocks like this chapter’s from a menu: run AURA: Write R code and look under R4 Test. Run its Settings block (name the test variables) first: it names the columns every test block uses.
Step by step:
Running the test
The test is three short blocks. The first describes each group, because the write-up needs each group’s size, mean, and standard deviation, and the test itself does not print them. The second is t.test(), R’s own t-test, which runs the Welch version by default. The third is cohens_d(), from the effectsize package, for the effect size. Under R4 Test, the R Companion’s Write R code writes these same blocks:
library(tidyverse)
library(effectsize)
analysis <- read_rds("data/twitch_analysis.RDS")
analysis %>%
filter(!is.na(is_gaming), !is.na(message_length)) %>%
group_by(is_gaming) %>%
summarize(n = n(), mean = mean(message_length), sd = sd(message_length))
t.test(message_length ~ is_gaming, data = analysis)
cohens_d(message_length ~ is_gaming, data = analysis)The three blocks print:
# A tibble: 2 × 4
is_gaming n mean sd
<lgl> <int> <dbl> <dbl>
1 FALSE 3457 33.7 60.7
2 TRUE 31305 28.5 38.5
Welch Two Sample t-test
data: message_length by is_gaming
t = 4.9418, df = 3768.7, p-value = 8.077e-07
alternative hypothesis: true difference in means between group FALSE and group TRUE is not equal to 0
95 percent confidence interval:
3.144345 7.280115
sample estimates:
mean in group FALSE mean in group TRUE
33.70234 28.49011
Cohen's d | 95% CI
------------------------
0.13 | [0.09, 0.16]
- Estimated using pooled SD.
FALSE is non-gaming and TRUE is gaming. The t.test() and cohens_d() lines drop the few messages with no text on their own, which is why the summary filters them out first: every number comes from the same 34,762 messages.
The test is named in its first line as a Welch two-sample t-test, and the choice of the Welch version is deliberate. The ordinary t-test assumes the two groups have the same spread, and Chapter 12 showed plainly that they do not: the non-gaming standard deviation, 60.7, is far larger than the gaming standard deviation of 38.5. Welch’s t-test drops that assumption, which is why it is the safer default whenever two groups might vary by different amounts.
The rest of the output is the result, and it has three parts worth reading slowly. The t value, 4.94, measures the gap between the means in units of its own uncertainty: roughly, how many widths of sampling noise separate the two averages. A value near zero would mean the gap is small compared to the noise; a value of about five means it is large compared to the noise. The sign is only direction: R sorts FALSE (non-gaming) first, so the difference is non-gaming minus gaming and t is positive; listed gaming first, as in the write-up below, it is -4.94. The df, or degrees of freedom, is a number the test uses to turn t into a probability; Welch’s test computes it from the two groups’ sizes and spreads, which is why it is not a round number. And the p-value is the answer to the question the whole test was built to ask.
Reading the p-value
The p-value printed here is 8.077e-07, R’s shorthand for 0.0000008, which a write-up reports as “< .001.” Stating exactly what that means takes care, because the p-value is the most misread number in statistics.
It means this: if gaming and non-gaming chat truly had the same mean message length, so that the null hypothesis were true, then drawing a sample with a gap at least as large as the observed five characters would happen less than one time in a thousand. The data are, in other words, very surprising under the assumption that nothing is going on. By the convention that researchers apply, a p-value below the threshold of .05 counts as statistically significant, and a p-value this small clears that bar easily. Chance alone is an unconvincing explanation for the gap.
That convention deserves a note of its own. The .05 threshold is exactly that, a convention, with no deep justification; a p-value of .049 and one of .051 describe almost identical evidence, and treating one as a discovery and the other as a non-event is a habit the field is right to question (Wasserstein & Lazar, 2016).
What matters more is being precise about what the p-value does not say. It is not the probability that the null hypothesis is true; the null is either true or false, and the p-value is a statement about data, not about hypotheses. It is not the probability that the result is a fluke. And, most important for what follows, it is not a measure of how large the difference is, or of how much the difference matters. A small p-value says the gap is probably not zero. It says nothing at all about whether the gap is big.
Justify your α. The .05 threshold is a convention, not a law. Run ten tests on one dataset without correction and you expect at least one false positive by chance alone, so declaring the number of tests and any correction procedure in advance, as pre-registration requires, is what keeps that inflation in check. Report the α you chose, state why it fits your design, and apply it consistently. The American Statistical Association’s guidance frames the deeper point, that a threshold is a convention rather than a verdict:
“Scientific conclusions and business or policy decisions should not be based only on whether a p-value passes a specific threshold.”
Wasserstein & Lazar (2016, p. 131)
Lakens et al. (2018) argue that different research contexts justify different thresholds; for your own study, ask what would justify using α = .01 rather than .05.
How big is the difference
For that, the p-value has to hand the question to a different number: an effect size.
A p-value answers “is there a difference.” An effect size answers “how much of one.” The effect size for a gap between two means is Cohen’s d, and it works by expressing the gap not in raw characters but in units of how much the data naturally vary. The output reports a Cohen’s d of 0.13 (-0.13 with gaming listed first), with a 95% confidence interval from 0.09 to 0.16.
To read that number, it needs a yardstick, and the standard one comes from Jacob Cohen (1988), who proposed rough benchmarks: a d around 0.2 is a small effect, around 0.5 a medium one, and around 0.8 a large one. A d of 0.13, smaller than even the “small” benchmark, falls into the range usually called negligible. The difference between gaming and non-gaming message length is real, in the sense that the test ruled out chance, and it is also trivially small.
This is worth dwelling on, because it sounds like a contradiction and is not. The raw gap is about five characters, roughly fifteen percent of the non-gaming average, and fifteen percent does not sound negligible. But Cohen’s d measures the gap against the spread of the data, and message lengths vary enormously, with standard deviations of thirty-eight and sixty-one characters. A five-character difference set against that much variation is a ripple. The percentage sounds substantial; the effect size, which is the honest comparison, is not.

That leaves one question: how did a negligible difference come back statistically significant at all? The answer is the sample size. The test ran on 34,762 messages, and with a sample that large, a hypothesis test can detect a difference far too small to care about. This is the rule to carry forward: a large enough sample will make almost any difference, however tiny, statistically significant. Significance and size are different questions, and big samples pull them apart.
Power and the strength of a claim. Sample size cuts the other way too. A significant result from a well-powered study (at least 80%) is stronger evidence than the same result from an underpowered one: underpowered studies that reach significance do so partly through sampling variation, which inflates the effect-size estimate. The report carries two numbers beyond p. The first is the confidence interval on the effect: here the 95% interval on the difference in means runs from 3.14 to 7.28 characters, so the gap is pinned down tightly even though it is small. The second is a sensitivity analysis: the smallest effect this sample could have detected at 80% power. With 31,305 and 3,457 messages, that is about d = 0.05, computed from the two group sizes:
(qnorm(0.975) + qnorm(0.80)) * sqrt(1 / 31305 + 1 / 3457)Read it as a statement about what a null result would have meant: had the test come back non-significant, the sample was large enough that any true difference above about a twentieth of a standard deviation would probably have shown, so the null would have been informative. A study of 60 messages could say no such thing, and its null result would mean only that it could not tell. Report the detectable effect for your own design alongside the p-value, and say what it means for a null result; a generic “80 percent power” with no link to your sample sizes is not a power statement.
The assumptions underneath the t-test. The test assumes independent observations, similar spread in the two groups, and either roughly normal data within each group or a sample large enough that the mean’s distribution is normal anyway. Check each with the diagnostic shown. Spread: the standard deviations of 60.7 and 38.5 from the summary above differ, so the Welch version is used, which drops that assumption. Normality: the histogram shows strong right skew in both groups, which the sample size absorbs for the mean, though not for any claim about individual messages. Independence is the one that fails here and cannot be fixed by a different test: messages from the same channel are not independent of each other, and the section at the end of this chapter is about what that costs. State what you did about each assumption that fails, not only that you checked it.
Seeing the difference
The two facts, a real gap and a negligible one, are easier to hold together as a picture. Plotting each group’s mean with its ninety-five percent confidence interval, a band that reflects how precisely the mean is estimated, puts both on the same axis:
means_ci <- analysis %>%
filter(!is.na(is_gaming)) %>%
group_by(is_gaming) %>%
summarize(
mean = mean(message_length, na.rm = TRUE),
se = sd(message_length, na.rm = TRUE) / sqrt(n()),
.groups = "drop"
) %>%
mutate(
lower = mean - 1.96 * se,
upper = mean + 1.96 * se,
group = if_else(is_gaming, "Gaming", "Non-gaming")
)
ggplot(means_ci, aes(group, mean, color = group)) +
geom_errorbar(aes(ymin = lower, ymax = upper), width = 0.14, linewidth = 0.9) +
geom_point(size = 3.4) +
v2v::scale_color_v2v() +
scale_y_continuous(limits = c(0, NA)) +
labs(x = NULL, y = "Mean message length (characters)") +
v2v::theme_v2v() +
theme(legend.position = "none")
The intervals are so short they nearly vanish behind the points, a direct consequence of the large sample: with tens of thousands of messages, each group’s mean is pinned down precisely. That the two intervals do not overlap is the visual signature of a statistically significant difference. And yet the two points sit close together near the top of the axis, both far above zero, so the eye reads them as almost the same height. That is the negligible effect size made visible. The gap is real enough that the intervals clear each other, and small enough that against the scale of the data it barely shows.
Statistical significance is not practical importance
Putting the two numbers together is the call the chapter is named for, and it is a more careful call than “significant or not.”
The finding is this. Gaming and non-gaming channels do differ in their mean chat-message length; the difference is statistically significant, unlikely to be an accident of sampling. And the difference is negligible in size, about five characters, a word’s worth, dwarfed by how much message lengths vary in the first place. Both halves are true, and a report that gave only the first half would mislead. A reader who heard “gaming and non-gaming chat differ significantly, p < .001” and nothing else would picture a real divide between two kinds of community. The effect size corrects the picture: there is a divide, and it is almost too small to see.
This is the difference between statistical significance and practical significance, and it is perhaps the single most important habit this book asks for. Statistical significance asks whether an effect is distinguishable from zero. Practical significance asks whether the effect is large enough to matter. They are not the same question, large samples make them diverge, and a finding is only honestly reported when both are on the page.
In practice that means a result is written up with the full set of numbers, in the compact form journals expect. The models in this chapter follow APA style, one widely used style; a paper may use another, as long as it keeps to that one style throughout:
Gaming channels produced shorter chat messages on average than non-gaming channels (28.49 vs. 33.70 characters; n = 31,305 and 3,457), Welch’s t(3768.7) = -4.94, p < .001, Cohen’s d = -0.13.
Four numbers are always in that line: the test statistic, its degrees of freedom, the p-value, and the sample size for each group. The n is the one most often left out, and it is the one that tells a reader how much to trust the rest.
And then, because a string of statistics is not an interpretation, it is written up a second time in a sentence a non-statistician can read: gaming and non-gaming channels do differ in how long their chat messages run, but the difference is so small that for most purposes the two are better thought of as alike than as different. That sentence is the call. It reports the real difference, refuses to inflate it, and tells the reader what the study actually found. One more sentence follows it, saying what the result does not let you claim: it holds for these fifty channels in one week of November 2018, not for Twitch in general, and it says nothing about why the two kinds of chat differ.
Gaming channels produced shorter chat messages on average than non-gaming channels (28.49 vs. 33.70 characters; n = 31,305 and 3,457), Welch’s t(3768.7) = -4.94, p < .001, Cohen’s d = -0.13.
| Part | In the model |
|---|---|
| The finding, in words | Gaming channels produced shorter messages |
| Group means and sizes | 28.49 vs. 33.70 characters; n = 31,305 and 3,457 |
| Test and degrees of freedom | Welch’s t(3768.7) = -4.94 |
| p | p < .001 (R printed a value smaller than .001) |
| Effect size | Cohen’s d = -0.13 (keeps its zero, because d can exceed 1) |
Plain sentence: gaming and non-gaming channels differ in how long their messages run, but the difference is so small that the two are better thought of as alike.
Common mistake: reporting p alone, or leaving out the n for each group.
The pre-registration disclosure. A pre-registered study names it in the write-up: “This study’s hypotheses, measures, and analysis plan were pre-registered in [file path] in the project repository, committed on [date] before data collection.” Anything you ran beyond that plan is labeled exploratory and read with corresponding caution. For your own study, draft the disclosure you would put in the methods section, and list any deviations from the plan and how you would report them.
Two categorical variables: chi-square
Chapter 12 left a cross-tabulation on the table: gaming status against whether a message carries an at-mention, with addressed messages at about 7 percent of non-gaming chat and about 10 percent of gaming chat. Both variables are nominal, so the test is the chi-square test of independence. It asks whether the counts in the cells differ from what they would be if the two variables had nothing to do with each other.
The test starts from a table of counts. xtabs() builds it from the two columns, sum() of that table is the N the write-up reports, chisq.test() runs the test, cramers_v() gives the effect size, and the last line prints the counts the table would hold if the two variables were unrelated.
mentions <- analysis %>%
filter(!is.na(is_gaming), !is.na(message)) %>%
mutate(has_mention = str_detect(message, "@"))
counts <- xtabs(~ has_mention + is_gaming, data = mentions)
sum(counts)
chi <- chisq.test(counts)
chi
cramers_v(counts, adjust = FALSE)
round(chi$expected, 1)[1] 34762
Pearson's Chi-squared test with Yates' continuity correction
data: counts
X-squared = 31.154, df = 1, p-value = 2.383e-08
Cramer's V | 95% CI
-------------------------
0.03 | [0.02, 1.00]
- One-sided CIs: upper bound fixed at [1.00].
is_gaming
has_mention FALSE TRUE
FALSE 3128.1 28326.9
TRUE 328.9 2978.1
R applies Yates’ continuity correction to a two-by-two table on its own, a small adjustment that makes the test slightly more conservative. The pattern is the same one the t-test produced, and it is worth seeing twice. The p-value is tiny, so the three-point gap is not sampling noise: at-mentions really are a little more common on gaming channels in this sample. The effect size for a chi-square is Cramer’s V, which runs from zero for no association to one for a perfect one, and 0.03 is as close to zero as a real association gets. Written up: whether a message carries an at-mention is associated with whether its channel is gaming, χ²(1, N = 34,762) = 31.15, p < .001, Cramer’s V = .03, and the association is negligible. In plain words, addressed chat is a small minority everywhere, and the kind of channel barely moves it. The smallest expected count, 328.9, is far above the usual floor of 5, so the chi-square’s assumption about cell sizes holds here. The v2v package keeps run_t_test() and run_chi_square() as deprecated shortcuts for work already written with them; new work uses the calls above.
Whether a message carried an at-mention was associated with whether its channel was gaming, χ²(1, N = 34,762) = 31.15, p < .001, Cramer’s V = .03.
| Part | In the model |
|---|---|
| The finding, in words | At-mention and channel type are associated |
| Test, degrees of freedom, and N | χ²(1, N = 34,762) = 31.15 |
| p | p < .001 (R printed 2.383e-08) |
| Effect size | Cramer’s V = .03 (no zero before the point, because V cannot exceed 1) |
Plain sentence: addressed chat is a small minority on every kind of channel, and the kind of channel barely moves it.
Common mistake: leaving N out of the parentheses, or calling the association strong because p is tiny.
Two continuous variables: correlation
The third test pairs two continuous variables and asks whether they move together. The chat study has such a pair at the level of the channel rather than the message: how many messages a channel produced in the week, and how long its messages ran on average. A reasonable hunch is that busier channels produce shorter messages, because a fast chat leaves no time to type. The Pearson correlation measures that: its statistic, r, runs from -1 for two variables that move in perfect opposition, through zero for no relationship, to +1 for two that rise together, and r is its own effect size.
per_channel <- analysis %>%
filter(!is.na(message)) %>%
group_by(channel) %>%
summarize(
messages = n(),
mean_length = mean(message_length),
.groups = "drop"
)
cor.test(~ messages + mean_length, data = per_channel)Pearson's product-moment correlation
t = -0.9526, df = 48, p-value = 0.3456
95 percent confidence interval:
-0.3994182 0.1477346
sample estimates:
cor
-0.1362145
The correlation is -0.14, in the direction the hunch expected, and the p-value is .35: with fifty channels, a correlation this weak is well within what sampling noise produces, and the confidence interval runs from -0.40 to +0.15, which includes zero and both signs. Written up: across the fifty channels, message count and mean message length were not detectably associated, r(48) = -.14, p = .35, 95% CI [-.40, .15]. This is the test where the sample is small, fifty channels rather than thirty-five thousand messages, and the result shows what that costs: the study cannot tell whether a weak association exists. That is the honest reading, and it is a different kind of statement from the two tests before it. There, big samples made negligible effects significant. Here, a small sample leaves a possibly real effect undetected. The same arithmetic produces both, and neither p-value says how much anything matters.
Across the 50 channels, a channel’s message count and its mean message length were not detectably associated, r(48) = -.14, p = .35, 95% CI [-.40, .15].
| Part | In the model |
|---|---|
| The finding, in words | Not detectably associated |
| Statistic and degrees of freedom | r(48) = -.14; the df is the number of channels minus 2 |
| p | p = .35, written exactly because it is above .001 |
| Interval | 95% CI [-.40, .15], which includes zero |
Plain sentence: with only 50 channels, the study cannot tell whether busier channels have shorter messages.
Common mistake: writing “no relationship”; a result above .05 means a relationship was not detected, not that none exists.
More than two groups: ANOVA
The t-test settled a question with exactly two sides: gaming versus non-gaming. Many questions have more. Suppose the study asked not whether gaming and non-gaming chat differ, but whether chat length differs across the specific games being played. Keep each channel’s main_game, the modal category built in Chapter 11, alongside is_gaming, restrict the data to its four largest categories, and four means appear rather than two:
game category n mean length
Fortnite 4000 33.23
Hearthstone 3004 36.82
Just Chatting 2429 39.03
League of Legends 4000 22.63
A t-test cannot settle this, because a t-test compares two means and there are four. Comparing them two at a time, Fortnite against Hearthstone, Hearthstone against Just Chatting, and so on, is worse than useless: it takes six separate tests, each carrying its own chance of a false positive, and those chances pile up. The test built for the whole comparison at once is the analysis of variance, or ANOVA. It asks a single question of all the groups together: is any of these means different enough from the rest that chance is an unconvincing explanation? aov() fits it and summary() reports it:
four_games <- analysis %>%
filter(main_game %in% c("Fortnite", "Hearthstone",
"Just Chatting", "League of Legends"))
fit <- aov(message_length ~ main_game, data = four_games)
summary(fit) Df Sum Sq Mean Sq F value Pr(>F)
main_game 3 547281 182427 92.26 <2e-16 ***
Residuals 13429 26552407 1977
The grouping column is main_game, the channel’s usual category, not game, the category at the moment each message was sent. Grouping by game runs without complaint and returns a different F, because it sorts the same messages into the categories by a different rule.
The logic is the t-test’s logic, widened. Where the t-test produced a t, ANOVA produces an F, and F compares two kinds of variation: the variation between the group means against the variation within the groups. If the four categories truly shared a mean, the spread between them would be no larger than the ordinary noise inside each, and F would sit near one. Here F is 92.26, far above one, and the p-value is minuscule: the categories do not all share a mean. League of Legends chat, at 22.63 characters, runs visibly shorter than Just Chatting at 39.03.
And, exactly as with the t-test, significance is not size. The effect size for ANOVA is eta-squared (η²), the share of the total variation in message length that the game category accounts for. Here it is 0.02: category explains about two percent of the variation in how long messages run. The categories differ, the difference is real, and it is small, the same honest pair of facts the t-test forced.
Mean message length differed across the four game categories (N = 13,433), F(3, 13429) = 92.26, p < .001, η² = .02. League of Legends chat ran shortest (M = 22.63 characters) and Just Chatting chat longest (M = 39.03).
| Part | In the model |
|---|---|
| The finding, in words | Mean length differed across the categories |
| Test and its two degrees of freedom | F(3, 13429): categories minus 1, then messages minus categories |
| p | p < .001 |
| Effect size | η² = .02, about two percent of the variation |
| The means | The lowest and highest group means |
Plain sentence: the game being played makes a real but small difference to how long messages run.
Common mistake: naming which pairs of games differ from F alone; that takes a follow-up comparison such as Tukey’s HSD.
From difference to model: regression
The t-test and ANOVA both compare group means. A third tool asks a subtly different question: not “do the groups differ” but “how much does one variable move with another.” That tool is linear regression, and its reach is wide enough to contain the other two.
Return to the original two-group question, but fit it as a regression, an lm(), a linear model of message length on gaming status:
fit <- lm(message_length ~ is_gaming, data = analysis)
summary(fit) Estimate Std. Error t value Pr(>|t|)
(Intercept) 33.70 0.70 48.08 < .001
is_gamingTRUE -5.21 0.74 -7.06 < .001
Read the two numbers. The intercept, 33.70, is the mean message length of the reference group, non-gaming channels. The coefficient on is_gamingTRUE, -5.21, is exactly the gap the t-test found: gaming channels average 5.21 characters fewer. The regression has re-derived the t-test’s result and cast it in a new form, a baseline plus an adjustment. (Its t of -7.06 differs a little from the Welch test’s -4.94 because a plain regression pools the two groups’ spread rather than letting them differ; the coefficient, the difference itself, is identical.)
That the regression reproduces the t-test is not a coincidence. A t-test is a regression with a single two-level explanatory variable; an ANOVA is a regression with a single many-level one. All three belong to one framework, the general linear model, and once a study is written as a regression it can grow in ways a t-test cannot: a second explanatory variable added, a continuous one rather than a categorical one, several associations weighed at once. This chapter’s study needs only the two-group comparison, so the t-test is enough. But regression is where inference stops being a menu of separate tests and becomes one extensible way of modeling how one variable is associated with several others at once. The variables on the right of the formula are called predictors in most software and most textbooks; the word is a convention of the method, and it does not license a claim that one variable predicts or causes another in the world. Its effect size here tells the same story a third time: the model’s R², the share of variance it explains, is about 0.001, so gaming status accounts for almost none of the variation in message length.
Gaming status, coded 1 for gaming and 0 for non-gaming channels, was associated with message length, b = -5.21, SE = 0.74, t(34760) = -7.06, p < .001, R² = .001.
| Part | In the model |
|---|---|
| The predictor and its coding | Gaming status: 1 for gaming, 0 for non-gaming |
| Slope | b = -5.21, in the outcome’s units: characters |
| Its precision | SE = 0.74 |
| Test and degrees of freedom | t(34760) = -7.06; the df is messages minus 2 |
| p | p < .001 |
| Variance explained | R² = .001 |
Plain sentence: messages on gaming channels ran about five characters shorter, and gaming status accounts for almost none of the variation in message length.
Common mistake: writing that gaming status causes shorter messages; a regression slope describes an association.
The assumptions underneath aov() and lm(). Running the model and reading the output is the first step; the numbers earn trust only once their assumptions are checked. ANOVA and ordinary regression assume the groups share a common variance (homoscedasticity), and Chapter 12 showed the chat groups plainly do not, which is why the two-group test used Welch’s correction, and why oneway.test() (Welch’s ANOVA) is the safer choice over the pooled aov() above. A significant ANOVA says only that some pair of means differs, not which; naming the pairs takes post-hoc comparisons (Tukey’s HSD, TukeyHSD()) that correct for the multiple looks. A regression’s credibility rests on its residuals: plot(fit), where fit is the regression model saved above (the R Companion’s Linear regression block saves its model under the same name), draws the diagnostic quartet: residuals-versus-fitted for linearity and equal spread, a Q–Q plot for normal residuals, and leverage for influential points. And whether an added predictor earns its place is a question of model comparison, adjusted R² and AIC or a nested F-test, not raw R², which never falls when a predictor is added. For your own design, name the test it calls for, the assumption most at risk in your data, and the diagnostic or robust alternative you would use to handle it.
How much the finding depends on one decision
A test tells you whether a gap is larger than sampling noise. It cannot tell you whether the gap survives a different but equally defensible definition of the groups being compared. Checking that is called a robustness check, or an alternative-specification check: run the analysis again under the other defensible choice and report whether the finding holds. Here it does not, and that turns out to matter more than the test.
is_gaming was built as a property of the channel: each channel’s modal category across the week, applied to every message that channel sent. The same data supports a second operationalization. Label each message by the category the channel was actually streaming when it was sent, read from the nearest earlier stream snapshot.
| How the label is defined | gaming | non-gaming | gap |
|---|---|---|---|
| the channel’s modal category | 28.49 (n = 31,305) | 33.70 (n = 3,457) | +5.21 |
| the category on screen at the time | 29.11 (n = 30,707) | 28.13 (n = 4,044) | -0.98 |
Under the second definition the gap reverses direction, falls to about one character, and is no longer statistically significant: Welch’s t(4993.6) = 1.34, p = .18.
Neither calculation is wrong, and they are not in competition. They answer different questions, and the distance between them is concentrated in one fact worth seeing plainly: the non-gaming group is five channels. bobross, hitch, xqcow, tjsmith and darksydephil, three of them at the corpus’s 1,000-message cap, 3,457 messages between them. xqcow alone is 29 percent of the group, and that channel is filed under Just Chatting for most of the week while spending a good deal of it playing games. Under the channel-level label every one of its messages is non-gaming. Under the message-level label most of them are not.
Two things follow, and both belong in the write-up.
The unit of analysis problem is doing real work here. The label varies across 48 channels, five of which are non-gaming, while the test is computed over 34,762 messages. The p-value answers “could 34,762 independent draws have produced this gap by chance”. The question that matters is “could five channels”, and the answer to that one is much less comfortable.
And the finding has to be stated at the level it was actually measured. Not “gaming chat is shorter”, but “chat on the five predominantly non-gaming channels in this sample is longer on average, by an amount too small to matter, and the difference does not survive relabeling messages by what was on screen at the time”.
That is a duller sentence, and it is the one the data supports.
Looking ahead
The chat study now has all of its pieces. It has a question and a theory, a prospectus, a codebook tested for reliability, a sample, a clean dataset, three figures, and a tested finding interpreted honestly. What it does not yet have is a form. The pieces are scattered across scripts and outputs, and a study that cannot be read as a single coherent document is not yet finished. Chapter 14 is where it becomes one. It is the publication chapter, where everything built since Chapter 9 is assembled into a single reproducible report and put where other people can read it.
References
Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Lawrence Erlbaum Associates.
Wasserstein, R. L., & Lazar, N. A. (2016). The ASA’s statement on p-values: Context, process, and purpose. The American Statistician, 70(2), 129-133. https://doi.org/10.1080/00031305.2016.1154108
Graduate readings
Lakens, D., Adolfi, F. G., Albers, C. J., Anvari, F., Apps, M. A. J., Argamon, S. E., … Zwaan, R. A. (2018). Justify your alpha. Nature Human Behaviour, 2, 168–171. https://doi.org/10.1038/s41562-018-0311-x