匠人府分享 http://blog.sciencenet.cn/u/meiweipingg

博文

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

已有 16698 次阅读 2016-11-25 09:12 |个人分类:数据处理与统计分析|系统分类:科研笔记| test

用数据说话系列(4): 独立样本、配对样本及单样本 t 检验 样本数 至少每组多少为宜

梅卫平

Basic knowledge worth spreading!



姑且先不说 t检验前提要求数据服从正态分布,以下两点需要注意:

# 注意点一:一般来讲,希望有80% 以上的统计功效(Statistical Power Level)假设检验才有效。

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

# n number of observations (per group).


结果显示:一般情况(即达到80%以上统计功效的前提下),


两独立样本双尾 t检验至少需要每组 17 个样本,

两独立样本单尾 t 检验最少需要每组 13 个样本。

补充:

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.8070

0.830

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检验显著结果只是因为你的运气吗?

2. Power calculations for one and two sample t tests

3. Statistical power

4.统计功效和效应值

5. t.test with varying delta


纰漏和错误之处在所难免,恳请您批评指正!


系列文章>>

用数据说话系列(1): 样本数,数据顺序对 t test 的影响

用数据说话系列(2): 样本数,数据顺序对"聚类分析"的影响

用数据说话系列(3): 样本数,数据顺序对"方差分析ANOVA"的影响

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

用数据说话系列(5): 非参数检验SteelDwass test和 Dunn test选谁





http://blog.sciencenet.cn/blog-651374-1016649.html

上一篇:x~y1+y2+...的情况下,ggplot2作柱状图及误差棒
下一篇:R语言中的anova()并非单因素方差分析的ANOVA

0

该博文允许注册用户评论 请点击登录 评论 (1 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2020-11-25 17:11

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部