# 用数据说话系列(4): 各种 t 检验 样本数 至少每组多少为宜

# 注意点一：一般来讲，希望有80% 以上的统计功效（Statistical Power Level）假设检验才有效。

# 注意点二：另外，效应量（Effect Size，或R语言中为delta），反映处理效应大小的度量。即，两样本平均数的差异，一般delta=1

# n number of observations (per group).

power.t.test(power = 0.8,delta = 1,type = "paired")

#  n=9.937864

#双尾 配对样本 t检验 至少每组 10 个样本

power.t.test(power = 0.8,delta =1,type = "paired",alternative = "one.side")

# n = 7.727622

#单尾配对样本t检验至少每组8个样本

power.t.test(power = 0.8,delta =1,type = "one.sample")

# n = 9.937864

#双尾 单样本 t检验 至少每组 10 个样本

power.t.test(power = 0.8,delta =1,type = "one.sample",alternative = "one.side")

# n = 7.727622

#单尾单样本t检验至少每组8个样本

When delta=1,power against n for independent two-sample t-test("n" indicates sample number per group)

 n 1 2 3 4 5 6 7 8 9 10 Power Na 0.09131 0.1572 0.2224 0.2859 0.3471 0.4056 0.4611 0.5133 0.5619 n 11 12 13 14 15 16 17 18 19 20 Power 0.6070 0.6486 0.6867 0.7214 0.7529 0.7813 0.807 0.83 0.850 0.8689 n 21 22 23 ... 50 100 1000 10000 … Power 0.8852 0.8997 0.9124 0.9986 0.9999 1 1

Note: two-side t-test.

# 计算过程（在R软件中运行）如下：

#----------------------------------------------------------

> power.t.test(n = 4, delta = 1)

Two-sample t test power calculation

n = 4

delta = 1

sd = 1

sig.level = 0.05

power = 0.2224633     # 样本数为4的话，统计功效very bad

alternative = two.sided

NOTE: n is number in *each* group

> power.t.test(n = 20, delta = 1)

Two-sample t test power calculation

n = 20

delta = 1

sd = 1

sig.level = 0.05

power = 0.8689528   # 样本数为20 的话，统计功效 good

alternative = two.sided

NOTE: n is number in *each* group

> power.t.test(power = 0.80, delta = 1)

Two-sample t test power calculation

n = 16.71477   # very important  # 两样本双尾t test，至少每组17个样本

delta = 1

sd = 1

sig.level = 0.05

power = 0.8

alternative = two.sided

NOTE: n is number in *each* group

> power.t.test(power = 0.80, delta = 1, alternative = "one.sided")

Two-sample t test power calculation

n = 13.09777   # very important  # 两样本单尾t test，至少每组13个样本

delta = 1

sd = 1

sig.level = 0.05

power = 0.8

alternative = one.sided

NOTE: n is number in *each* group

# --------------------------------------------------

# 特定情况，比如：效用值（Effect Size或曰 delta）为2的时候

> power.t.test(power = 0.80, delta = 2)

Two-sample t test power calculation

n = 5.090008  # 特定条件，效用值=2 的情况，双尾只需要至少每组 5个样本

delta = 2

sd = 1

sig.level = 0.05

power = 0.8

alternative = two.sided

NOTE: n is number in *each* group

> power.t.test(power = 0.80, delta = 2, alternative = "one.sided")

Two-sample t test power calculation

n = 3.987012  # 特定条件，效用值=2 的情况，单尾只需要至少 每组 4 个样本

delta = 2

sd = 1

sig.level = 0.05

power = 0.8

alternative = one.sided

NOTE: n is number in *each* group

1. 李淼新您的t检验显著结果只是因为你的运气吗？

4.统计功效和效应值

https://wap.sciencenet.cn/blog-651374-1016649.html

## 全部精选博文导读

GMT+8, 2023-3-26 10:57