Advanced Quantitative Methods 360-301 • CEGEP, Montreal

Corrected exercises: comparing two groups (360-301)

These ten corrected exercises open Advanced Quantitative Methods, 360-301, in the CEGEP Social Science program, with the most frequent operation in all of research: comparing two groups, with the right test, the right effect size and the right sample size. They cover Student's t-test for two independent samples and its pooled variance, the F test for equality of variances and the Welch correction, the paired-samples t-test, Cohen's d, the confidence interval of a difference between means, statistical power, and Type I and Type II errors.

By the end of the set, you can carry out a complete independent-samples t-test, from the hypotheses to the conclusion (exercise 1), check the homogeneity of variances and apply Welch (exercise 2), test before-and-after differences and measure what pairing gains (exercise 3), compute a Cohen's d and a confidence interval (exercise 4), and find the sample size needed for 80% power (exercise 5). Part B sets out the decision tree that leads to the right test, as far as the Mann-Whitney test and the chi-square test (exercise 6), the complete evaluation of a randomized workshop, analyzed by intention to treat (exercise 9), and a critical reading of the results section of an article (exercise 10).

The thread of the set fits in one sentence: the p-value depends on the sample size, the effect size does not, and they answer different questions. The same gap of 1.5 points is harmless with 40 subjects and highly significant with 1,000, although nothing has changed in reality (exercise 7).

Three pitfalls are named outright, and exercise 8 has you correct them: two measurements of the same people treated as independent samples, a failure to reject read as proof of no effect, and the p-value mistaken for the probability that the null hypothesis is true.

10 corrected exercises • 100 points • 150 minutes

This chapter is part of 360-301, every chapter with its set and sheet Before you start Revision sheet: the traps and the method for this chapter

Self-checking set Type your answers and check them question by question: the page tells you right or wrong before you open the solution. With an account, every answer right on the first try earns points, and your right answers stay filled in when you come back.

Course recap

  • • Independent-samples t-test: sp2=(n1−1)s12+(n2−1)s22n1+n2−2s_{p}^{2}=\dfrac{\left(n_{1}-1\right)s_{1}^{2}+\left(n_{2}-1\right)s_{2}^{2}}{n_{1}+n_{2}-2}, SE=sp1n1+1n2SE=s_{p}\sqrt{\dfrac{1}{n_{1}}+\dfrac{1}{n_{2}}}, df=n1+n2−2df=n_{1}+n_{2}-2.
  • • WELCH correction: SE=s12n1+s22n2SE=\sqrt{\dfrac{s_{1}^{2}}{n_{1}}+\dfrac{s_{2}^{2}}{n_{2}}}, with reduced degrees of freedom. It is the default choice today.
  • • F test for equality of variances: the larger variance goes in the numerator. It has little power and is sensitive to non-normality.
  • • PAIRED samples: we work on the nn individual differences, t=d‾sd/nt=\dfrac{\overline{d}}{s_{d}/\sqrt{n}}, df=n−1df=n-1.
  • • Pairing removes the variability between individuals and costs degrees of freedom. It pays off as soon as the two measurements are correlated.
  • • Cohen's d=x‾1−x‾2spd=\dfrac{\overline{x}_{1}-\overline{x}_{2}}{s_{p}}: 0.2 small, 0.5 medium, 0.8 large. It does NOT depend on the sample size.
  • • A 95% confidence interval for the difference contains zero if and only if the two-tailed test at the 5% level fails to reject.
  • • Sample size for 80% power: n≈2(1.96+0.84)2d2n\approx \dfrac{2\left(1.96+0.84\right)^{2}}{d^{2}} per group. Halving dd QUADRUPLES the sample size.
  • • Type I error α\alpha: rejecting wrongly. Type II error β\beta: missing a real effect. Power =1−β=1-\beta.
  • • The p-value is the probability of the gap IF H0H_{0} is true, never the probability that H0H_{0} is true.
  • • Choosing the test: independent or paired, quantitative or categorical variable, two groups or more, distribution or sample size sufficient.

Part A: the basics (/50)

Exercise 1: The t-test for two independent samples

Comparing two means is the most frequent operation in advanced quantitative methods. The t-test compares the observed gap with what the luck of sampling would produce, and everything hinges on the denominator.

Two groups in a quantitative methods course: the treated group, 25 students, mean 72.4 and standard deviation 8.2; the control group, 28 students, mean 67.9 and standard deviation 9.6.

4050607080901000.010.020.030.040.050.06control: 67.9treated: 72.4
  • a) State the null and alternative hypotheses.
  • b) Compute the pooled variance sp2=(n1−1)s12+(n2−1)s22n1+n2−2s_{p}^{2}=\dfrac{\left(n_{1}-1\right)s_{1}^{2}+\left(n_{2}-1\right)s_{2}^{2}}{n_{1}+n_{2}-2} and the standard error of the difference.
  • c) Compute the statistic tt and the number of degrees of freedom.
  • d) The two-tailed critical value at the 5% level is 2.008. Conclude.
  • e) The graph shows two distributions that overlap heavily. Does that contradict a test?

Type your answers, the page tells you right or wrong 0/12

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) H0H_{0}: μ1=μ2\mu_{1}=\mu_{2}. Two-tailed H1H_{1}: μ1≠μ2\mu_{1}\neq \mu_{2}
  • b) sp2≈80.433s_{p}^{2}\approx 80.433, sp≈8.968s_{p}\approx 8.968, standard error ≈2.468\approx 2.468
  • c) t=4.52.468≈1.824t=\dfrac{4.5}{2.468}\approx 1.824, with 5151 degrees of freedom
  • d) 1.824<2.0081.824<2.008: fail to reject; the p-value is about 0.0740.074
  • e) No: the test is about the means, far more precise than individuals; the overlap tells the PRACTICAL SIGNIFICANCE
a)

NULL hypothesis: μ1=μ2\mu_{1}=\mu_{2}, the two groups come from populations with the same mean, and the observed gap is due only to the luck of sampling. Two-tailed ALTERNATIVE hypothesis: μ1≠μ2\mu_{1}\neq \mu_{2}. We choose the two-tailed version because nothing was announced in advance about the DIRECTION of the effect; adopting a one-tailed test after seeing that the treated group is ahead would quietly double the significance level.

b)

sp2=24×8.22+27×9.6251=24×67.24+27×92.1651=1,613.76+2,488.3251=4,102.0851≈80.433s_{p}^{2}=\dfrac{24\times 8.2^{2}+27\times 9.6^{2}}{51}=\dfrac{24\times 67.24+27\times 92.16}{51}=\dfrac{1{,}613.76+2{,}488.32}{51}=\dfrac{4{,}102.08}{51}\approx 80.433, so sp≈8.968s_{p}\approx 8.968. Standard error of the difference: sp125+128=8.9680.04+0.035714=8.968×0.275162≈2.468s_{p}\sqrt{\dfrac{1}{25}+\dfrac{1}{28}}=8.968\sqrt{0.04+0.035714}=8.968\times 0.275162\approx 2.468. The pooled variance is an average WEIGHTED by the degrees of freedom: the larger group counts for more, which makes sense since it estimates the common variance better.

c)

t=72.4−67.92.468=4.52.468≈1.824t=\dfrac{72.4-67.9}{2.468}=\dfrac{4.5}{2.468}\approx 1.824. Degrees of freedom: n1+n2−2=25+28−2=51n_{1}+n_{2}-2=25+28-2=51. The statistic reads as a ratio: the observed gap is 1.82 times the standard error of what luck alone would produce.

d)

∣t∣=1.824<2.008\left|t\right|=1.824<2.008: we FAIL TO REJECT the null hypothesis. The data therefore do not allow us to conclude that the means differ at the 5% level. We must be careful not to write that the two groups are equal: the p-value is about 0.074 here, which leaves the hypothesis of a difference very much alive, and a larger sample might bring it out.

e)

No, it is not contradictory, and the graph helps explain the result. The test is NOT about the overlap of the individual distributions but about the precision of the MEANS, which is much better than that of individuals, since it is divided by the square root of the number of subjects. Two distributions can overlap almost entirely and have very significantly different means if the samples are large. Conversely, as here, a huge overlap signals that even if the difference were real, its PRACTICAL SIGNIFICANCE would be limited: a student drawn from the treated group has a little under seven chances in ten of beating the median of the control group.

Tick the exercises you have done or want to review: a free account, no password, keeps your ticks and your right answers from one visit to the next, tells you which chapter to tackle next and lets you ask for the exercise you are missing. Create your space, an email is enough.

Exercise 2: Equal variances or not: the F test and the Welch correction

The classical t-test assumes that the two populations have the SAME variance. The assumption can be checked, and when it fails, a correction exists.

  • a) Compute the variance ratio F=smax⁡2smin⁡2F=\dfrac{s_{\max}^{2}}{s_{\min}^{2}} for the two groups of exercise 1.
  • b) The critical value of FF with 27 and 24 degrees of freedom is about 2.20 at the 5% two-tailed level. Conclude on homogeneity.
  • c) Compute the Welch standard error, s12n1+s22n2\sqrt{\dfrac{s_{1}^{2}}{n_{1}}+\dfrac{s_{2}^{2}}{n_{2}}}, and the corresponding tt.
  • d) The Welch degrees of freedom are about 50.9. Compare with the classical version and conclude.
  • e) When does the correction really change the conclusion?

Type your answers, the page tells you right or wrong 0/12

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) F=92.1667.24≈1.371F=\dfrac{92.16}{67.24}\approx 1.371
  • b) 1.371<2.201.371<2.20: homogeneity acceptable, the classical t-test is usable
  • c) Welch standard error ≈2.446\approx 2.446, so t≈1.840t\approx 1.840
  • d) 50.950.9 against 5151: negligible loss, same conclusion
  • e) When variances AND sample sizes are unbalanced, especially if the small group has the large variance
a)

F=9.628.22=92.1667.24≈1.371F=\dfrac{9.6^{2}}{8.2^{2}}=\dfrac{92.16}{67.24}\approx 1.371. The larger variance always goes in the numerator, so that F≥1F\ge 1 and a single table is enough.

b)

1.371<2.201.371<2.20: we fail to reject the equality of variances. The homogeneity assumption is therefore acceptable, and the classical t-test can be used. Note that this F test is itself weak on small samples and very sensitive to non-normality: many statisticians now recommend using the Welch correction from the start and not testing the equality of variances at all.

c)

Welch standard error: 67.2425+92.1628=2.6896+3.29143=5.98103≈2.44562\sqrt{\dfrac{67.24}{25}+\dfrac{92.16}{28}}=\sqrt{2.6896+3.29143}=\sqrt{5.98103}\approx 2.44562. Statistic: t=4.52.44562≈1.84005t=\dfrac{4.5}{2.44562}\approx 1.84005. The difference from the classical version is tiny, 1.840 against 1.824, because the variances are close and the sample sizes comparable.

d)

Welch gives 50.9 degrees of freedom against 51 for the classical version: the loss is negligible here. The critical value stays close to 2.008, and the conclusion is the same, we fail to reject. The Welch formula lowers the degrees of freedom all the more as the variances and the sample sizes are unbalanced; in the worst case, it brings them down to the size of the smaller group minus one.

e)

The correction really changes the conclusion when the two imbalances combine: very different variances AND very different sample sizes. The dangerous case is the one where the SMALL group has the LARGE variance: the classical test, by weighting the pooled variance by the degrees of freedom, then underestimates the standard error and rejects too often, with an actual risk well above the announced 5%. When, on the contrary, the large group carries the large variance, the classical test becomes too conservative. In both cases, Welch corrects, and its cost when the homogeneity assumption is true is limited to a few tenths of a degree of freedom: that is why it has become the default choice.

Exercise 3: Paired samples: testing the differences

When the two measurements are on THE SAME people, before and after, the samples are no longer independent. We no longer compare two means: we test whether the mean of the individual differences is zero.

Ten students, differences between the second and the first exam: 4, −1-1, 6, 3, 0, 5, 2, 7, 1, 3.

−20246810difference, after minus before, per student
  • a) Compute the mean and the standard deviation of the differences.
  • b) Compute the statistic t=d‾sd/nt=\dfrac{\overline{d}}{s_{d}/\sqrt{n}} and its degrees of freedom.
  • c) The two-tailed critical value with 9 degrees of freedom is 2.262. Conclude.
  • d) Had these twenty measurements been treated as two independent groups of 10, with a standard deviation of 9 in each group, what would the test have given?
  • e) Explain what pairing gains, and name what it costs.

Type your answers, the page tells you right or wrong 0/16

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) d‾=3.0\overline{d}=3.0 and sd≈2.582s_{d}\approx 2.582
  • b) t=3.00.8165≈3.674t=\dfrac{3.0}{0.8165}\approx 3.674, with 99 degrees of freedom
  • c) 3.674>2.2623.674>2.262: reject, p-value close to 0.0050.005
  • d) t=3.04.025≈0.745t=\dfrac{3.0}{4.025}\approx 0.745: we would not reject
  • e) Pairing removes the variability between individuals (ss drops from 99 to 2.582.58) at the price of degrees of freedom
a)

Sum: 4−1+6+3+0+5+2+7+1+3=304-1+6+3+0+5+2+7+1+3=30, so d‾=3010=3.0\overline{d}=\dfrac{30}{10}=3.0. Deviations from the mean: 11, −4-4, 33, 00, −3-3, 22, −1-1, 44, −2-2, 00; their squares: 1, 16, 9, 0, 9, 4, 1, 16, 4, 0, with sum 60. Sample variance: 609≈6.667\dfrac{60}{9}\approx 6.667, so sd≈2.582s_{d}\approx 2.582.

b)

Standard error: 2.58210=2.5823.1623≈0.8165\dfrac{2.582}{\sqrt{10}}=\dfrac{2.582}{3.1623}\approx 0.8165. Statistic: t=3.00.8165≈3.674t=\dfrac{3.0}{0.8165}\approx 3.674, with n−1=9n-1=9 degrees of freedom. Note that the sample here is made of the DIFFERENCES, ten numbers and not twenty: that is what explains the 9 degrees of freedom.

c)

3.674>2.2623.674>2.262: we REJECT the null hypothesis. The mean improvement of 3.0 points is significant at the 5% level; the p-value is about 0.005, so the result also holds at the 1% level. The conclusion is about the existence of an improvement, not its cause: without a control group, maturation, testing effects and regression to the mean remain competing explanations.

d)

Standard error of the difference between two independent means: 9110+110=9×0.4472≈4.0259\sqrt{\dfrac{1}{10}+\dfrac{1}{10}}=9\times 0.4472\approx 4.025. Statistic: t=3.04.025≈0.745t=\dfrac{3.0}{4.025}\approx 0.745, with 18 degrees of freedom and a critical value of 2.101: we would NOT reject. The same 3-point gap therefore goes from highly significant to perfectly harmless depending on the treatment chosen.

e)

The gain comes from ELIMINATING the variability between individuals. By working on the differences, everything specific to each student, starting level, motivation, study method, disappears by subtraction, and only the variability of the CHANGE remains, here much smaller: the standard deviation drops from 9 to 2.58. What pairing costs is twofold. First, degrees of freedom: 9 instead of 18, which raises the critical value from 2.101 to 2.262. Second, a design constraint: the same people must be measured twice, which exposes the study to testing effects and attrition. The gain wins out by far as soon as the two measurements are strongly correlated, which is almost always the case for a school before-and-after.

−20246810difference, after minus before, per studentmean: 3

Exercise 4: Effect size and the confidence interval

The p-value says whether the gap can be told apart from luck. It does not say whether the gap matters. Two quantities answer that second question, and a serious journal now requires both.

0.58d = 0.20.69d = 0.50.79d = 0.80.88d = 1.20.5share of the treated group above the control median
  • a) Compute Cohen's dd for the two groups of exercise 1, with d=x‾1−x‾2spd=\dfrac{\overline{x}_{1}-\overline{x}_{2}}{s_{p}}.
  • b) Interpret it with the usual benchmarks, then in terms of overlap.
  • c) Build the 95% confidence interval of the difference between the means.
  • d) The interval contains zero. How does that relate to the result of the test in exercise 1?
  • e) Why publish the interval rather than the p-value alone?

Type your answers, the page tells you right or wrong 0/9

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) d=4.58.968≈0.502d=\dfrac{4.5}{8.968}\approx 0.502
  • b) MEDIUM effect: about 69%69\% chance of beating the control median
  • c) 4.5±4.9554.5\pm 4.955, that is [−0.455,9.455][-0.455, 9.455] points
  • d) Exactly equivalent: the interval contains zero if and only if the two-tailed test fails to reject
  • e) Because it shows the imprecision, from a drop of half a point to a rise of nine and a half points
a)

d=72.4−67.98.968=4.58.968≈0.502d=\dfrac{72.4-67.9}{8.968}=\dfrac{4.5}{8.968}\approx 0.502. The difference is therefore about half a standard deviation.

b)

Usual benchmarks: 0.2 small, 0.5 medium, 0.8 large. The effect is therefore MEDIUM. In terms of overlap, a dd of 0.5 means that a student drawn at random from the treated group beats the median of the control group in about 69% of cases, against 50% if there were no effect, and beats a student drawn at random from the control group in about 64% of cases. These statements say far more than an abstract number, and they remind us that a medium effect leaves an immense zone of overlap.

c)

(x‾1−x‾2)±tcrit×SE=4.5±2.008×2.46776=4.5±4.955\left(\overline{x}_{1}-\overline{x}_{2}\right)\pm t_{crit}\times SE=4.5\pm 2.008\times 2.46776=4.5\pm 4.955, that is [−0.455, 9.455]\left[-0.455,\ 9.455\right] points.

d)

The link is exact, not approximate: a 95% confidence interval for the difference contains zero IF AND ONLY IF the two-tailed test at the 5% level fails to reject. The two procedures use the same statistic and the same critical value; they say the same thing in two forms. Checking this consistency is an excellent control against computational errors.

e)

Because the interval contains all the information of the p-value and more. Here, it says that the true difference could be a drop of half a point as well as a rise of nine and a half points: in other words, the study rules out neither the absence of an effect nor a considerable effect, and this is a finding of IMPRECISION more than of absence. A p-value of 0.074 reads as a failure, the interval reads as an invitation to repeat the study on a larger scale. That is why the recommendations of professional statistical associations have for years asked for intervals and effect sizes to be published, and for the mere crossing of the 5% threshold to stop being commented on.

Exercise 5: Power: how many subjects do we need?

Power is the probability of detecting an effect that really exists. It is chosen before the study, together with the sample size, and leaving it out is the main cause of inconclusive research.

For a t-test with two equal groups, 80% power at the 5% two-tailed level requires about n=2(1.96+0.84)2d2n=\dfrac{2\left(1.96+0.84\right)^{2}}{d^{2}} subjects per group.

0.20.40.60.811.21.4100200300400n per group, 80% powertarget d
  • a) Compute the sample size per group needed to detect a medium effect, d=0.5d=0.5.
  • b) Same question for a small effect, d=0.2d=0.2, and for a large effect, d=0.8d=0.8.
  • c) The study of exercise 1 had 25 and 28 subjects. What effect size could it have detected with 80% power?
  • d) Define the Type II error and relate it to power.
  • e) Does an inconclusive study with 26 subjects per group demonstrate the absence of an effect?

Type your answers, the page tells you right or wrong 0/12

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) 15.680.25=62.72\dfrac{15.68}{0.25}=62.72, that is 6363 per group and 126126 in all
  • b) 392392 per group for d=0.2d=0.2, 2525 for d=0.8d=0.8: the sample size varies as 1d2\dfrac{1}{d^{2}}
  • c) d=15.6826≈0.78d=\sqrt{\dfrac{15.68}{26}}\approx 0.78: only a BIG effect
  • d) β\beta is the risk of missing a real effect, and power equals 1−β1-\beta
  • e) No: finding nothing was the expected outcome; publish the interval, not post hoc power
a)

n=2(2.80)20.25=2×7.840.25=15.680.25=62.72n=\dfrac{2\left(2.80\right)^{2}}{0.25}=\dfrac{2\times 7.84}{0.25}=\dfrac{15.68}{0.25}=62.72, that is 63 subjects per group, so 126 in all.

b)

For d=0.2d=0.2: 15.680.04=392\dfrac{15.68}{0.04}=392 subjects per group, that is 784 in all. For d=0.8d=0.8: 15.680.64=24.5\dfrac{15.68}{0.64}=24.5, that is 25 per group. The sample size varies as 1d2\dfrac{1}{d^{2}}: halving the effect size to be detected QUADRUPLES the required sample. That is why modest effects, which are the rule in the social sciences, call for studies that few teams can fund.

c)

With about 26 subjects per group, we solve 26=15.68d226=\dfrac{15.68}{d^{2}}, so d2=15.6826≈0.6031d^{2}=\dfrac{15.68}{26}\approx 0.6031 and d≈0.777d\approx 0.777. The study therefore had an 80% chance of detecting only a LARGE effect, close to 0.8. Yet the effect actually observed was 0.50: the study was undersized by a factor of about 2.4 for what it was looking for, and its inconclusive result was largely predictable BEFORE the data were collected.

d)

The SECOND type of error, denoted β\beta, is failing to reject H0H_{0} when it is false: missing a real effect. Power equals 1−β1-\beta. With 80% power, we therefore accept a one-in-five chance of missing an effect of the targeted size. The parallel with the Type I error is worth drawing: α\alpha is the risk of crying wolf, β\beta that of not seeing the wolf coming, and the two can only be reduced together by increasing the sample size.

e)

No. With 26 subjects per group, the study was unable to detect anything but a very large effect: finding nothing was the most likely outcome even if a medium effect existed. A failure to reject in an underpowered study therefore carries almost no information. What must be published in that case is the confidence INTERVAL of the difference, which will show that appreciable effects remain compatible with the data, and post hoc power should be avoided: it is merely a restatement of the p-value. The honest conclusion is “our data do not settle the question”, and the next study must be sized on the observed effect size.

0.20.40.60.811.21.4100200300400n per group, 80% power0.2 : 3920.5 : 630.8 : 25target d

Part B: problems and reasoning (/50)

Exercise 6: Choosing the right test

Four questions are enough to choose the appropriate comparison test. Taking the wrong branch produces a p-value that is perfectly computed and perfectly wrong.

  • a) State the four questions in the order in which they should be asked.
  • b) We compare the satisfaction, rated from 1 to 5, of two groups of 12 students. Which test?
  • c) We compare the median income of 400 men and 380 women. Which test, and why is non-normality not an obstacle?
  • d) We compare the grades of 30 students before and after a workshop. Which test? And if we also want a control group?
  • e) We compare the pass rate, passed or failed, of three programs. Which test?

Type your answers, the page tells you right or wrong 0/12

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) Independent or paired, quantitative or categorical variable, two groups or more, parametric or not
  • b) Mann-Whitney: ordinal variable and twelve subjects per group
  • c) Independent t-test with Welch; the central limit theorem rescues non-normality on 400 observations
  • d) Paired t-test; with a control, independent t-test on the individual differences
  • e) Chi-square test of independence on a 3 by 2 table, df=2df=2, then a Cramér's VV
a)

First question: are the groups INDEPENDENT or PAIRED, that is, the same units measured twice? Second question: is the dependent variable QUANTITATIVE or categorical? Third question: how many groups are being compared, TWO or more than two? Fourth question: does the distribution allow a parametric test, that is, is the variable approximately normal, or are the sample sizes large enough for the central limit theorem to apply? The order matters: the first question determines the family, the following ones refine it.

b)

Two independent groups, an ORDINAL variable and samples of 12, too small to invoke the central limit theorem: the appropriate test is the nonparametric MANN-WHITNEY test, which compares ranks rather than means. The t-test would be defensible if we accepted the convention that treats a Likert score as an interval variable, but with 12 subjects per group and a five-level variable, caution calls for ranks.

c)

Two independent groups, a quantitative variable, large samples: the independent-samples t-test is appropriate, with the Welch correction. The non-normality of income, which is strongly right-skewed, is not an obstacle because the test is about MEANS, and the sampling distribution of a mean tends toward the normal as nn grows, whatever the shape of the population: that is the central limit theorem. With nearly 400 observations per group, the approximation is excellent. One reservation remains: on such a skewed distribution, the mean is not necessarily the quantity of interest, and comparing the MEDIANS with a Mann-Whitney test would answer the question asked better.

d)

Thirty students measured twice: paired-samples t-test on the individual differences. With a control group, the question changes: we no longer test an improvement but a GAP between improvements, and we compare the individual differences of the treated group with those of the control group by an independent-samples t-test. This is the statistical version of the difference in differences, and it is the correct design for evaluating a workshop.

e)

The dependent variable is CATEGORICAL, passed or failed, and we compare three independent groups: no t-test applies. We build a 3 by 2 contingency table and use the chi-square test of independence, with df=(3−1)(2−1)=2df=\left(3-1\right)\left(2-1\right)=2, then a Cramér's VV for the strength. If an expected frequency fell below 5, we would merge programs or switch to Fisher's exact test.

Exercise 7: Significant and important are not synonyms

The same gap, measured on samples of different sizes, crosses the threshold or not. The graph shows the mechanism, and the question is about what should be said of it.

200400600800100012001.534.56t for a fixed gap of 1.5 pointscutoff 1.96n per group
  • a) Two groups of 40 students differ by 1.5 points, with a standard deviation of 9. Compute tt and conclude.
  • b) Redo it with 400 students per group, then 1,000.
  • c) Compute Cohen's dd in the three cases. What do you notice?
  • d) From what sample size does the 1.5-point gap become significant?
  • e) Write the sentence that correctly describes the result obtained with 1,000 subjects per group.

Type your answers, the page tells you right or wrong 0/9

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) t=1.52.012≈0.745t=\dfrac{1.5}{2.012}\approx 0.745: fail to reject
  • b) t≈2.357t\approx 2.357 with 400400 per group, t≈3.727t\approx 3.727 with 1,0001{,}000
  • c) d=1.59≈0.167d=\dfrac{1.5}{9}\approx 0.167 in all three cases: the effect size ignores the sample size
  • d) n≥276.6n\ge 276.6, that is 277277 subjects per group
  • e) Raw gap with its unit, test with its degrees of freedom, effect size, without confusing significant and important
a)

Standard error: 9240=9×0.22361≈2.01259\sqrt{\dfrac{2}{40}}=9\times 0.22361\approx 2.0125. Statistic: t=1.52.0125≈0.745t=\dfrac{1.5}{2.0125}\approx 0.745, very far from the critical value close to 1.99: we fail to reject.

b)

With 400 per group: standard error 92400=9×0.070711≈0.63649\sqrt{\dfrac{2}{400}}=9\times 0.070711\approx 0.6364, so t=1.50.6364≈2.357t=\dfrac{1.5}{0.6364}\approx 2.357, greater than 1.96: we reject. With 1,000 per group: standard error 9×0.044721≈0.402499\times 0.044721\approx 0.40249, so t≈3.727t\approx 3.727, far beyond the threshold.

c)

d=1.59≈0.167d=\dfrac{1.5}{9}\approx 0.167 in ALL THREE cases. The effect size does not depend on the sample size: it describes the separation of the two distributions, not the amount of data collected. That is exactly the role we ask of it, and that is why it must accompany every test.

d)

We look for nn such that 1.592/n≥1.96\dfrac{1.5}{9\sqrt{2/n}}\ge 1.96, so 2n≤1.59×1.96=0.085034\sqrt{\dfrac{2}{n}}\le \dfrac{1.5}{9\times 1.96}=0.085034, hence 2n≤0.0072308\dfrac{2}{n}\le 0.0072308 and n≥276.6n\ge 276.6, that is 277 subjects per group. Beyond that, a gap of 1.5 points out of 100, which interests nobody, will be declared significant every time.

e)

“The treated group scores on average 1.5 points higher than the control group, on a scale of 100, a statistically significant difference, t(1,998)=3.73t\left(1{,}998\right)=3.73, p below 0.001, but with a very small effect size, d=0.17d=0.17. This gap is about one sixth of a standard deviation, and it has no identifiable practical significance for an individual student.” The sentence gives the three required elements, the raw gap with its unit, the test with its degrees of freedom, the effect size, and it explicitly refuses to turn significance into importance.

Exercise 8: Five statements to correct

Each of the following five statements is FALSE. Say why and give the correct statement.

  • 1) “p=0.074p=0.074: there is a 7.4% chance that the null hypothesis is true.”
  • 2) “Our two distributions overlap almost entirely: no test can be significant.”
  • 3) “We measured the same 30 students before and after, then compared the two means with an independent-samples t-test.”
  • 4) “The test is not significant with 26 subjects per group: the workshop therefore has no effect.”
  • 5) “Our dd is 0.17 but pp is 0.0002: the effect is therefore both small and important.”

Type your answers, the page tells you right or wrong 0/8

1)
2)
3)
4)
5)
Show the solution

Answers

  • 1) FALSE: p is the probability of the gap IF H0H_{0} is true, not the probability that H0H_{0} is true
  • 2) FALSE: with 1,0001{,}000 per group, d=0.17d=0.17 gives t≈3.7t\approx 3.7 and p<0.001p<0.001
  • 3) FALSE: paired measurements, so a paired t-test with 2929 degrees of freedom on the differences
  • 4) FALSE: with 2626 per group, only an effect of 0.780.78 was detectable; we would need 6363
  • 5) FALSE: the effect is very clearly established AND very small, which is not contradictory
1)

FALSE. The p-value is the probability of observing a gap at least this large IF the null hypothesis were true, not the probability that the null hypothesis is true. The two quantities are inverted conditional probabilities, like the probability of being wet given that it rains and the probability that it rains given that we are wet. Correct statement: if the two groups came from identical populations, we would observe a gap at least this large in 7.4% of repetitions of the study.

2)

FALSE. The test is about the MEANS, whose standard error is sn\dfrac{s}{\sqrt{n}} and decreases without limit as the sample size grows, whereas the overlap of the individual distributions does not depend on it. With 1,000 subjects per group, a dd of 0.17, hence an enormous overlap, gives t≈3.7t\approx 3.7 and a p-value below 0.001. Correct statement: a heavy overlap indicates a small effect size, not the impossibility of a significant result.

3)

FALSE. The two measurements are on the same people: they are not independent, and treating the sixty measurements as two separate samples inflates the standard error by feeding all the variability between individuals back into it. On the example of the chapter, the tt fell from 3.67 to 0.75 for the same data. Correct statement: we compute the 30 individual differences and test whether their mean is zero, with a PAIRED-samples t-test with 29 degrees of freedom.

4)

FALSE. With 26 subjects per group, the study had an 80% chance of detecting only an effect of size 0.78, that is, a big effect. Finding nothing was the expected outcome even in the presence of a medium effect. Correct statement: our data do not allow a conclusion; the confidence interval of the difference runs from −0.5-0.5 to +9.5+9.5 points, which leaves open the possibility of an appreciable effect, and a study of about 63 subjects per group would be needed.

5)

FALSE, the conclusion mixes up the two notions. A tiny p-value only indicates that the gap is hard to attribute to luck, which, with large samples, happens for any gap whatsoever. Importance is judged on the dd and on the unit of measurement, and a dd of 0.17 is small. Correct statement: the effect is very clearly established and very small; it is real and without obvious practical significance, which is in no way contradictory.

Exercise 9: Problem: the complete evaluation of a workshop

A CEGEP is evaluating a study-methods workshop. Among 96 applicants, 48 are drawn by lot for the current semester, and the other 48 form the waitlist. We measure the semester average.

Treated group: 48 students, mean 74.2, standard deviation 10.4. Control group: 48 students, mean 70.1, standard deviation 11.1.

The graph below shows the data.

304050607080901001100.010.020.030.04control: 70.1treated: 74.2
  • a) Justify the design and say what kind of validity it provides.
  • b) Compute the pooled variance, the standard error, the tt and the degrees of freedom.
  • c) The two-tailed critical value with 94 degrees of freedom is 1.986. Conclude.
  • d) Compute the effect size and the confidence interval of the difference.
  • e) Nine of the 48 tutored students attended no session and score 68.9. How should they be handled?

Type your answers, the page tells you right or wrong 0/15

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) Waitlist experiment: internal validity ensured, external validity limited to applicants
  • b) sp2=115.685s_{p}^{2}=115.685, standard error 2.1952.195, t≈1.868t\approx 1.868 with 9494 degrees of freedom
  • c) 1.868<1.9861.868<1.986: fail to reject, p-value close to 0.0650.065
  • d) d≈0.381d\approx 0.381 and [−0.260,8.460][-0.260, 8.460]: the study is imprecise, not negative
  • e) Keep them: intention to treat, the only analysis that preserves the equivalence of the random draw
a)

This is a WAITLIST EXPERIMENT with random assignment among the applicants. It provides INTERNAL validity: the two groups differ on average only by the treatment, including on unmeasured variables, so the observed difference can be attributed to the workshop. EXTERNAL validity remains limited to the students who ASK for such a workshop, a population that is not that of the CEGEP as a whole.

b)

The sample sizes being equal, sp2=47×10.42+47×11.1294=10.42+11.122=108.16+123.212=231.372=115.685s_{p}^{2}=\dfrac{47\times 10.4^{2}+47\times 11.1^{2}}{94}=\dfrac{10.4^{2}+11.1^{2}}{2}=\dfrac{108.16+123.21}{2}=\dfrac{231.37}{2}=115.685, so sp≈10.7557s_{p}\approx 10.7557. Standard error: 10.7557248=10.7557×0.204124≈2.1954910.7557\sqrt{\dfrac{2}{48}}=10.7557\times 0.204124\approx 2.19549. Statistic: t=74.2−70.12.19549=4.12.19549≈1.8675t=\dfrac{74.2-70.1}{2.19549}=\dfrac{4.1}{2.19549}\approx 1.8675, with 48+48−2=9448+48-2=94 degrees of freedom.

c)

1.868<1.9861.868<1.986: we fail to reject at the 5% level. The p-value is about 0.065, so the result is close to the threshold without reaching it. The correct wording is that the study does not establish an effect, not that the workshop has none.

d)

d=4.110.7557≈0.381d=\dfrac{4.1}{10.7557}\approx 0.381, a SMALL TO MEDIUM effect. Confidence interval: 4.1±1.986×2.19549=4.1±4.36024.1\pm 1.986\times 2.19549=4.1\pm 4.3602, that is [−0.260, 8.460]\left[-0.260,\ 8.460\right] points. It contains zero, in exact agreement with the test, and above all it shows that the true difference could reach eight and a half points: the study is imprecise rather than negative. A replication with about 110 students per group, the sample size required to detect d=0.38d=0.38 with 80% power, would settle the question.

e)

They must be KEPT in the treated group, and this analysis presented as the main one: it is the INTENTION-TO-TREAT analysis, and it is what preserves the equivalence produced by the random draw. Removing the nine absentees would amount to comparing a subgroup selected by its own behaviour, probably the least engaged, with a complete control group, which would inflate the effect. A complementary analysis restricted to the 39 students who actually took part can be published, labelled as such and noting that it gives an optimistic upper bound. The question that intention to treat answers is the decision maker's: what does OFFERING the workshop produce, knowing that some of those enrolled will not come.

Exercise 10: Problem: reading a “results” section

Excerpt from an article: “Female students obtain a higher average than male students (M=73.8M=73.8 against M=70.2M=70.2; t(1,198)=4.12t\left(1{,}198\right)=4.12; p<0.001p<0.001). The effect of gender on achievement is therefore demonstrated. Moreover, no difference was found between programs (p=0.21p=0.21), which shows that the program does not influence achievement.”

  • a) Recover the total sample size and the order of magnitude of the standard error from the degrees of freedom and the tt.
  • b) Compute the approximate effect size if the common standard deviation is 15. Interpret.
  • c) “The effect of gender on achievement is demonstrated”: two objections.
  • d) “No difference was found, which shows that the program does not influence”: what is wrong with it?
  • e) Rewrite the paragraph.

Type your answers, the page tells you right or wrong 0/13

a)
b)
c)
d)
e)
Show the solution

Answers

  • a) n=1,200n=1{,}200, that is 600600 per group; standard error 3.64.12≈0.874\dfrac{3.6}{4.12}\approx 0.874
  • b) d=3.615=0.24d=\dfrac{3.6}{15}=0.24: small effect, distributions overlapping by more than 90%90\%
  • c) “Demonstrated” for a dd of 0.240.24, and “effect” on a variable that was not assigned
  • d) A failure to reject is not proof of absence; the interval and the sizes of the programs are missing
  • e) Raw gaps, effect sizes, intervals (1.91.9 to 5.35.3 points), and two findings of indecision
a)

With df=n1+n2−2=1,198df=n_{1}+n_{2}-2=1{,}198, the total sample size is 1,200, that is about 600 per group if the groups are balanced. The standard error follows from the tt: SE=73.8−70.24.12=3.64.12≈0.874SE=\dfrac{73.8-70.2}{4.12}=\dfrac{3.6}{4.12}\approx 0.874. We can check consistency: with s=15s=15 and 600 per group, SE=152600≈0.866SE=15\sqrt{\dfrac{2}{600}}\approx 0.866, which agrees. This recalculation is a good reading reflex: it catches inconsistencies and lets you reconstruct what the article did not publish.

b)

d=3.615=0.24d=\dfrac{3.6}{15}=0.24, a SMALL effect. In other words, the distributions overlap by more than 90%, and knowing a student's gender only marginally improves the prediction of the grade. The p-value below 0.001 comes almost entirely from the 1,200 subjects, not from the size of the gap.

c)

First objection, the word DEMONSTRATED applied to an effect of 0.24: the study establishes a small difference between means, and has demonstrated nothing more. Second objection, the word EFFECT, which asserts causality: gender was not randomly assigned, and the gap may reflect differences in chosen program, hours of paid work, relationship to school, all correlated with gender. The correct wording speaks of a difference ASSOCIATED with gender, not an effect of gender.

d)

A failure to reject is not proof of absence. With p=0.21p=0.21, the data are COMPATIBLE with the null hypothesis, and just as compatible with differences of several points, as the confidence interval that the article does not publish would show. We would also need to know the number of programs compared and the size of each: a comparison among six programs of 200 students does not have the same power as one between two programs of 600.

e)

“Female students obtain an average of 73.8 against 70.2 for male students, a gap of 3.6 points, a statistically significant difference, t(1,198)=4.12t\left(1{,}198\right)=4.12; p<0.001p<0.001, but of small magnitude, d=0.24d=0.24, with a confidence interval of 1.9 to 5.3 points. Since gender was not assigned, this difference cannot be interpreted as a causal effect. The comparison between programs does not allow a conclusion, p=0.21p=0.21; the confidence interval of the gap between the extreme programs remains nevertheless compatible with differences of several points, and the study therefore cannot rule out a link.” The paragraph gives the raw gaps, the effect sizes, the intervals, and replaces two overreaching claims with two findings of indecision.

Something missing from this set? A type of exercise your teacher gives, a problem you are stuck on, a mistake you spotted: tell me, I read every request.

Sending goes through your free space: that is how I can answer you and tell you when the exercise is added. An email is enough, no password. Create your space. Rather not create an account? Write to me directly.

What is it about?
I read every request myself, nobody else sees it. No need to write your name or your school.
When your request is dealt with, you hear about it by email and in your space.

By sending, you agree that I read your request to answer it. It is kept with your account, erased with it, and never published: privacy policy.

Next chapter One-way analysis of variance, 360-301

© Ahmed Squalli Houssaini. Exercise set published at www.letuteurscientifique.ca/en/exercices/cegep-aqm-comparing-two-groups. Free for personal and classroom use; republishing it elsewhere requires written permission (legal notice).

See also

Looking for an advanced quantitative methods tutor in Montreal?

Get in touch for a first session. The 360-301 comes at the time of the end-of-program research project, and it is the course where a mistake in method costs the whole analysis chapter.

Site by Studio Squalli