


TB sections 5.4
2025-11-17
Let’s watch this youtube video to remind us of what we learned (stop at 3:30):
Single-sample mean:



Paired mean difference:



Diff in means of 2 ind samples:



Try filling out this table:
| One-sample | Independent two-sample | Paired sample | |
|---|---|---|---|
| Example | Body temp: Population mean is 98.6°F, is sample different? | Caffeine: taps/min between caffeine and non-caffeine group | Vegetarian diet: cholesterol before and after |
| Sample statistic | |||
| Population parameter | |||
| Possible hypothesis tests | |||
| Standard error | |||
| Test statistic | |||
| Confidence intervals |
Study Design:1
What elements are at play?
More familiar with first two, but let’s define #3 and #4 more



Power (or sensitivity) (\(1 - \beta\)): Probability of rejecting the null hypothesis given that the null is false (correct)

From the applet at https://rpsychologist.com/d3/NHST/
Let’s look at the following scenarios:
Solve for power: decreasing type 1 error (\(\alpha\))
Solve for power: increasing type 1 error (\(\alpha\))
Solve for power: decrease sample size
Solve for power: increase sample size
Solve for power: increase difference of means
Solve for power: decrease difference of means
From the applet at https://rpsychologist.com/d3/NHST/


Let’s say we have:
Find the power of a 2-sided test if the actual mean is \(3\) and our significance level is 0.05.
Let’s say we have:
Find the power of a 2-sided test if the actual mean is \(3\) and our significance level is 0.05.


Thus under the alternative population, we need to calculate \(P(X_A \le -1.96) + P(X_A \ge 1.96)\)
Under the alternative population we have \(X_A \sim Norm(3,1)\)
[1] 0.8508304
Answer: The power is 85%
pnorm(-1.96, mean=3, sd=1, lower.tail=TRUE) is essentially 0 in this case.pwr for power analyses1pwr.t.test for both one- and two-sample t-testsLeave out:
n: returns sample sized: returns Cohen’s d/effect size (next slide)sig.level: get significance level (not typical)power: returns powerd is Cohen’s d effect size
One-sample test (or paired t-test):
\[d = \frac{\overline{x}-\mu_0}{s}\]
\[d = \frac{\overline{x}_d-\delta_0}{s_d}\]
Two-sample test (independent):
\[d = \frac{\bar{x}_1 - \bar{x}_2}{s_{pooled}}\]
d: \[d = \frac{\overline{x}-\mu_0}{s}\]pwr: sample size for one mean testSpecify all parameters except for the sample size:
pwr: power for one mean testSpecify all parameters except for the power:
pwr: Two-sample t-test: sample sizeExample: Let’s revisit our caffeine taps study. Investigators want to know what sample size they would need to detect a 2 point difference between the two groups. Assume the SD in both group samples is 2.6.
Specify all parameters except for the sample size:
pwr: Two-sample t-test: powerExample: Let’s revisit our caffeine taps study. Investigators want to know what power they have to detect a 2 point difference between the two groups. The two groups are both size 35 (like in our previous example). Assume the SD in both group samples is 2.6.
Specify all parameters except for the power:
Lesson 15 Slides