In 1908, the author signing as “Student” used sleep data from 10 patients in The Probable Error of a Mean to demonstrate small-sample inference. The numbers came from Cushny and Peebles’s pharmacology work and later entered R as the sleep dataset. They still suit explaining a paired t-test: the same 20 values yield very different standard errors if you keep the within-patient pairing versus splitting them into two independent groups.1[1]2[2]3[3]

This article starts with “which test to choose,” then reads results from a real Scholay Research Assistant conversation, and finally checks calculation and interpretation separately. One question runs through it: under the drug-2 condition, how much extra sleep did these 10 patients gain on average relative to drug 1?

When to use a paired t-test

A paired t-test compares two sets of observations that match one-to-one—for example, the same person under two treatments, or the same unit measured before and after an intervention. Subtract within each unit to get differences dᵢ, treat that column of differences as one sample, and test whether its population mean is 0.5[5]

Before using the test, confirm three things:

  1. The pairing is reliable, and differences from different patients are independent of one another.
  2. The target is a mean difference with clear units, and the numbers can be subtracted meaningfully.
  3. The normality model for the differences that small-sample inference relies on is reasonable—check the shape of the differences and any especially large observations.

This example fixes the subtraction direction as “drug 2 − drug 1.” The estimand is the population mean difference μ_d; the null is μ_d = 0 and the alternative μ_d ≠ 0, with a two-sided test. Once the order is fixed, the mean difference, t, and reporting all follow the same direction.

The data

sleep.csv is organized as a long table with 20 rows: patient is the patient ID, drug the drug ID, and extra_hours the added hours of sleep relative to a control condition. Each patient has one value under each drug; negatives mean less sleep than control. After aligning by patient, the pairing is clear.1[1]3[3]

Patient 1 2 3 4 5 6 7 8 9 10
Drug 1 0.7 −1.6 −0.2 −1.2 −0.1 3.4 3.7 0.8 0.0 2.0
Drug 2 1.9 0.8 1.1 0.1 −0.1 4.4 5.5 1.6 4.6 3.4
Difference (2 − 1) 1.2 2.4 1.3 1.3 0.0 1.0 1.8 0.8 4.6 1.4

The last row has 9 positives and 1 zero, with no negatives. The 10 differences sum to 15.8 hours and average 1.58 hours. When preparing the data, the critical step is aligning the two drug conditions by patient; once the difference column is fixed, the paired t-test is only about these 10 numbers.

Working in Scholay

  1. Open Scholay’s Research Assistant and start a conversation.
  2. Upload sleep.csv, keeping the three columns for patient ID, drug ID, and extra sleep hours.
  3. In the prompt, state who is paired with whom, the units, and which statistics you want.

The attachment gives extra sleep hours (extra_hours, in hours; drug = drug ID; patient = patient ID) for 10 patients after each of two sleeping drugs. Please compare the two drugs: choose an appropriate t-test, give a results table, and explain item by item the t statistic, degrees of freedom, p-value, 95% confidence interval for the mean difference, and effect size.

The prompt did not name “paired t-test” outright; it stated that the same patients received two treatments. This conversation used Qwen3.8 Flash (light); the page showed “processed in 1 min 26 sec.” The reply recognized that the two values from the same patient are not independent, tested the differences, and reported in the “drug 2 − drug 1” direction. Consecutive interface screenshots are Figures 1–4.4[4]

Setup panel: Student’s sleep paired design (10 patients; drug2 − drug1).

Figure 1 Scholay Research Assistant conversation “Comparing two sleeping drugs,” screen 1. Captured: 2026-11-16 08:35:22.675 UTC. Source: Scholay UI screenshot for this demand.4[4]

Reading the results table

The reply first listed descriptive statistics: mean extra sleep for drug 1 was 0.75 hours (SD 1.789); for drug 2, 2.33 hours (SD 2.002). After subtracting columns, the differences had mean 1.58 hours and SD 1.230. The main paired t-test table follows.4[4]

Measure This assistant’s main table
Mean difference (drug 2 − drug 1) 1.580 hours
t 4.062
Degrees of freedom df 9
Two-sided p-value 0.0028
95% CI for the mean difference [0.700, 2.460] hours
Cohen's d_z 1.28

Bar chart of ten paired differences (drug2 − drug1); mean 1.58 h.

Figure 2 Scholay Research Assistant conversation “Comparing two sleeping drugs,” screen 2. Captured: 2026-11-16 08:35:23.568 UTC. Source: Scholay UI screenshot for this demand.4[4]

The mean difference answers “how much more.” 1.58 hours is the average of person-by-person differences. The positive sign means more extra sleep under drug 2. It is also the most direct effect size that keeps the original units.

The t statistic compares the mean difference to its standard error. For the 10 differences, sample SD s_d = 1.229995 and SE = s_d / √10 = 0.388959 hours, so t = 1.58 / 0.388959 = 4.06213. The observed mean difference is about 4.06 times its standard error.5[5]

Degrees of freedom depend on the number of pairs. Here there are 10 differences; after estimating one mean, df = 10 − 1 = 9. The table has 20 rows of observations, but the analysis unit is still 10 pairs.5[5]

The p-value measures how compatible the data are with the null. When the population mean difference is 0 and the t-test model holds, the probability of getting |t| at least 4.06213 is about 0.002833, or 0.2833%. At a pre-set 0.05 level, reject the null of a zero mean difference.

Paired t-test results: t(9)=4.062, p=0.0028, mean diff 1.58 h, 95% CI (0.70, 2.46).

Figure 3 Scholay Research Assistant conversation “Comparing two sleeping drugs,” screen 3. Captured: 2026-11-16 08:35:24.489 UTC. Source: Scholay UI screenshot for this demand.4[4]

The confidence interval gives both direction and precision. Using 1.58 ± 2.262157 × 0.388959 yields [0.700114, 2.459886] hours. The whole interval lies above 0; its width of about 1.76 hours shows substantial remaining uncertainty about how large the average gain is. The 95% describes the interval construction: under the same model, repeating sampling and interval calculation would cover the population mean difference in about 95% of intervals in the long run.6[6]

d_z uses the SD of the differences as the unit. d_z = 1.58 / 1.229995 = 1.28456, reported as 1.28, meaning the mean difference is about 1.28 times the SD of the differences. Its link to the paired t is d_z = t / √n; keep the subscript when reporting so the standardization denominator is clear.7[7]

If standardized differences from different designs need to be discussed together, one may also compute d_av. Here the denominator is the arithmetic mean of the two condition SDs: d_av = 1.58 / [(1.789010 + 2.002249) / 2] = 0.83350, about 0.83. The gap versus d_z comes from the denominator; this assistant’s main table reports d_z.7[7]

What happens if paired data are treated as independent samples

With the same two columns, this article also ran a method contrast: ignore patient pairing and run a Welch t-test as two independent samples, yielding t(17.7765) = 1.86081, p = 0.079394, and a 95% CI for the mean difference of [−0.20548, 3.36548] hours. At the 0.05 level, this calculation no longer rejects a zero mean difference.8[8]

The change is in the denominator. The paired SE is 0.389 hours; split into independent samples it becomes 0.849 hours. Patients already differ in sleep level; subtracting within patient removes some individual variation shared by both conditions. The mean difference stays 1.58; the much smaller paired SE makes t larger and the interval narrower. The test should follow how the data were collected—keeping patient IDs when organizing the data preserves that information.

Checking assumptions

In its assumptions table, this assistant wrote that the differences showed “no obvious extremes (max 4.6).” But 4.6 sits apart from the other nine differences’ 0–2.4 hour range. A Shapiro–Wilk test on the differences gave W = 0.829871, p = 0.033342, suggesting incompatibility with a normal model. That result makes the original judgment look too optimistic.4[4]9[9]

Next, separate “whether one patient drives the mean-difference conclusion” from “whether the direction of differences is broadly consistent.” The table below is this article’s supplementary calculation on the same paired data.

Check This article’s supplementary result
Sign test Drop 1 zero difference; remaining 9 pairs all positive; two-sided p = 0.00390625
Wilcoxon signed-rank test Drop zero differences; positive rank sum 45, negative rank sum 0; enumerating all sign combinations gives two-sided p = 0.00390625
Bootstrap percentile interval for the mean difference Resample patient pairs with replacement 100,000 times; 95% interval [0.95, 2.38] hours
Leave one patient out Mean difference for remaining 9 pairs is 1.24–1.76 hours; largest two-sided paired t p-value is 0.00783

The sign test here can be done by hand: if the 9 nonzero differences were equally likely to be positive or negative, the two-sided probability that all share one sign is 2 × (1/2)⁹ = 0.00390625. For patient 9: temporarily drop this patient with difference 4.6; the remaining mean difference is still 1.24444 hours, t(8) = 5.65866, p = 0.000477. The direction is not propped up by that one larger difference alone; but “same direction” and “how much more sleep on average” remain two different pieces of information.10[10]11[11]

Reading notes for Student sleep paired t-test: formula t=4.062, Shapiro–Wilk caveat, outlier note, unpaired contrast, reject H0 at α=0.05 with normality caveat.

Figure 4 Scholay Research Assistant conversation “Comparing two sleeping drugs,” screen 4. Captured: 2026-11-16 08:35:25.520 UTC. Source: Scholay UI screenshot for this demand.4[4]

Checking the AI output

The main table’s calculations match: recomputation gives mean difference 1.58, difference SD 1.229995, SE 0.388959, t = 4.062128, df = 9, p = 0.00283289, 95% CI [0.700114, 2.459886], and d_z = 1.284558. Rounded to the decimals used in the main table, all agree with this reply. Only the expanded form written as 1.284 for d_z would round to 1.285 at three decimals; the table’s 1.28 needs no change.

Beyond calculation, two interpretation points need correction. First, normality of the differences cannot be judged by “the maximum is only 4.6”; checks in this example already show a noteworthy departure. Second, the reply said the effect size is “unaffected by sample size and directly captures the strength of practical meaning”—that overreaches: d_z is a sample estimate of a standardized difference, still subject to sampling variability, and estimation precision depends on sample size; practical meaning still returns to original units such as 1.58 hours and to the study context.4[4]7[7]

What these data cannot answer

sleep.csv keeps patient, drug condition, and sleep increment; it cannot support adjusting for dosing order or carryover. The 1905 source described alternating drug and control nights and then continuous dosing, but this summary table has no night-by-night record. Paired analysis controls who is compared, yet a significant p-value alone cannot attribute all observed difference to the drug itself.1[1]3[3]

The mean difference also does not guarantee an effect for every patient. Patient 5 had −0.1 hours under both conditions, so a difference of 0. What the table supports is: for this set of patients under drug 2, average extra sleep was 1.58 hours more than under drug 1; individual change still has to be read person by person.

Writing it into a paper

A two-sided paired-sample t-test was performed on extra sleep hours for 10 patients under two drug conditions. Means were 0.75 hours (SD = 1.79) for drug 1 and 2.33 hours (SD = 2.00) for drug 2; the mean of drug 2 minus drug 1 was 1.58 hours, 95% CI [0.70, 2.46], t(9) = 4.06, p = .003, d_z = 1.28.

The same report should also note the difference-distribution issue actually encountered: Shapiro–Wilk W = 0.830, p = .033; two-sided sign test after dropping zero differences p = .0039; mean differences stayed positive in leave-one-patient-out analyses. Methods should state the difference direction and the denominator for d_z; if d_av = 0.83 is also reported, note that it standardizes by the arithmetic mean of the two condition SDs.

References

  1. Cushny AR, Peebles AR. The action of optical isomers: II. Hyoscines. The Journal of Physiology, 1905, 32(5–6): 501–510. DOI: 10.1113/jphysiol.1905.sp001097.

  2. Student. The Probable Error of a Mean. Biometrika, 1908, 6(1): 1–25. MIT OpenCourseWare archived version.

  3. R Core Team. Student's Sleep Data (sleep). R datasets online documentation.

  4. Scholay Research Assistant. Comparing two sleeping drugs. Conversation and UI screenshots for this demand, 2026-11-16.

  5. NIST/SEMATECH. Analysis of paired observations. e-Handbook of Statistical Methods, §7.3.1.1.

  6. NIST/SEMATECH. Confidence Limits for the Mean. e-Handbook of Statistical Methods, §1.3.5.2.

  7. Lakens D. Calculating and reporting effect sizes to facilitate cumulative science: a practical primer for t-tests and ANOVAs. Frontiers in Psychology, 2013, 4: 863. DOI: 10.3389/fpsyg.2013.00863.

  8. R Core Team. Student's t-Test (t.test). R stats online documentation.

  9. R Core Team. Shapiro-Wilk Normality Test (shapiro.test). R stats online documentation.

  10. R Core Team. Wilcoxon Rank Sum and Signed Rank Tests (wilcox.test). R stats online documentation.

  11. R Core Team. Exact Binomial Test (binom.test). R stats online documentation.