MaizePrepSTATS 250
Exam 2 · Lec 12

Comparing two groups

Association between a two-level categorical explanatory variable and a quantitative response: boxplots, μ1−μ2\mu_1-\mu_2, the Welch t-test and interval, and the two-group effect size.

30 min

Key ideas

Roles

Explanatory variable XX (here, the grouping) and response YY (the outcome). Roles say which way you are explaining, not that XX causes YY. Avoid "independent/dependent variable"; the course saves independence for the relationship.

Informal evidence

Little overlap of side-by-side boxplots suggests association. Support it with one measure of center (medians or means) and one of location or spread (where the IQRs sit, or the extremes), written as sentences.

Parameter

μ1−μ2\mu_1-\mu_2: the true difference in mean [response] between [population 1] and [population 2]. Two populations. Not "the mean difference," which is the paired parameter.

Welch t-test

R always uses the Welch version with its own df. By hand the course uses the conservative df=min⁡(n1−1,n2−1)df = \min(n_1-1, n_2-1).

Reading an interval for μ1−μ2\mu_1-\mu_2

Entirely positive → evidence μ1>μ2\mu_1 > \mu_2; entirely negative → μ1<μ2\mu_1 < \mu_2; contains 0 → no evidence of a difference (not evidence of equality). Reversing the subtraction negates and swaps the endpoints.

Independent versus paired

Different units in each group → two-sample. The same units measured twice → one-sample t on differences (Lec 07).

Formulas (on the Exam 2 help card)

Standard error
SE(μ^1−μ^2)=σ^12n1+σ^22n2SE(\hat\mu_1-\hat\mu_2)=\sqrt{\frac{\hat\sigma_1^2}{n_1}+\frac{\hat\sigma_2^2}{n_2}}
Add the variances, then take the root; never add the two SEs.
Test and interval
t=(μ^1−μ^2)−0SE,(μ^1−μ^2)±t∗ SEt=\frac{(\hat\mu_1-\hat\mu_2)-0}{SE},\qquad (\hat\mu_1-\hat\mu_2)\pm t^*\,SE
Effect size
d^=t/n1n2n1+n2\hat d=t\Big/\sqrt{\tfrac{n_1n_2}{n_1+n_2}}
Worked example

Standing desks and daily steps

A company randomly samples 40 employees with standing desks and 50 with seated desks (employees chose their desks) and records average daily steps. Interpret the output.

t.test(steps ~ desk, data = staff)

	Welch Two Sample t-test

data:  steps by desk
t = 2.6291, df = 77.115, p-value = 0.01033
alternative hypothesis: true difference in means between group standing and group seated is not equal to 0
95 percent confidence interval:
 266.8993 1933.101
sample estimates:
mean in group standing mean in group seated 
                  8200                 7100 
# sample SDs: standing 2100, seated 1800
  1. Parameter: μstanding−μseated\mu_{standing} - \mu_{seated} = the true difference in mean daily steps between all of the company's standing-desk employees and all of its seated-desk employees.

  2. Statistic: 8200−7100=11008200 - 7100 = 1100 steps; SE =21002/40+18002/50≈418= \sqrt{2100^2/40 + 1800^2/50} \approx 418; t≈2.63t \approx 2.63: the observed difference is 2.63 standard errors above the hypothesized 0.

  3. p-value: assuming no difference in population mean steps, a t-statistic at least 2.63 away from 0 in either direction has probability about 0.010: strong evidence of a difference.

  4. Interval: we are 95% confident standing-desk employees average between about 267 and 1,933 more daily steps than seated-desk employees. Entirely positive, consistent with the test.

  5. Effect size: d^=2.629/40⋅50/90≈0.56\hat d = 2.629/\sqrt{40 \cdot 50/90} \approx 0.56, moderate. By-hand df would be min⁡(39,49)=39\min(39, 49) = 39.

Answer

Strong evidence of an association between desk type and mean daily steps, with a moderate estimated effect. Employees chose their desks, so this is not evidence that the desk causes the difference (Lec 13–14).

Check yourself

1
Lec 12

A study compares resting heart rate between randomly sampled adults who run regularly and adults who do not. Which is the best definition of μ1−μ2\mu_1 - \mu_2?

2
Lec 12

Groups of 23 and 31 are compared with a two-sample t-test. Using the course's by-hand rule, what df would you use for the multiplier?

3
Lec 12

A 95% interval for μA−μB\mu_A - \mu_B (mean minutes to finish a puzzle, brand A minus brand B) is (−4.2, −0.6). What does it support?

4
Lec 12

Side-by-side boxplots compare monthly data use for two phone plans. Select every summary that is good evidence of an association.

5
Lec 12

Group 1: σ^1=12\hat\sigma_1 = 12, n1=16n_1 = 16. Group 2: σ^2=20\hat\sigma_2 = 20, n2=25n_2 = 25. Compute SE(μ^1−μ^2)SE(\hat\mu_1 - \hat\mu_2). Give the exact value.

Math shortcuts are on for STATS 250. Type ^ then digits for powers, _ then digits for subscripts.
6
Lec 12

A Welch test gives t=−2.4t = -2.4 for μ1−μ2\mu_1 - \mu_2. What sign does d^\hat d have, and what does the sign say?

7
Lec 12

A survey of a university's students asks whether each lives in a dorm and how many hours per week they spend at the gym. Which describes the roles and types?

MaizePrep is an independent study resource. It is not affiliated with, sponsored by, or endorsed by the University of Michigan. Course names and numbers are used only to describe which class the material covers. Every practice question is original, written in the style of the course.