打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
最新!Nature对于统计量和p值的书写建议,附实现代码!

最新!Nature对于统计量和p值的书写建议

前不久Nature子刊《Nature human behaviour》编辑部发布了一则编辑部通告(Editorial),严肃讨论了p值的内涵以及解释方法,旨在呼吁人们重视科学研究结论的可重复性问题。

原文附在最后面,下面是原链接

https://www.nature.com/articles/s41562-023-01586-w

小编用ChatGPT翻译了一下,现在来尝试进行讲解,看看对于我们日常撰写报告和论文有什么指导和帮助。

翻译全文与重点提取

翻译经过ChatGPT润色,重点信息标注了加粗

摘要

本杂志社发表的大多数实证性文章使用零假设显著性检验(NHST)。在大多数情况下,研究人员依赖P值来确定研究结果的科学或实践意义。然而,统计学显著性单独所能提供的信息非常有限,对于推断这些科学或政策的意义其实用处不大。因此,除了P值之外,我们杂志社要求作者提供其他更多的信息——在这篇编辑社报告中,我们将解释本杂志社的要求。

正文

在过去的十年中,统计显著性和P值引起了很多讨论。2016年,美国统计协会发表了有关P值的声明,旨在消除与其有关的一些应用和结果解释上的误解。尽管目前对P值的误用有了更多的关注,但根据向我们杂志社投稿的研究论文可以了解到,美国统计协会声明想要消除的误解其实仍然存在。

在我们杂志社收到的大多数使用NHST的实证研究中,作者们只报告了统计检验方法、自由度、检验值和P值。甚至在某些情况下,作者只汇报P值,而并不包含其他信息。这种极其有限的信息可能会产生误导性的结果,再者,在样本量非常大的研究中甚至是没有意义的(因为在样本量非常大的研究中,即使效应很小,也可以呈统计学显著性)。因此,我们要求作者还需汇报效应量以及置信区间。NHST的统计报告通常应采用以下形式:统计量 = 值;P = 值;效应量 = 值;置信区间 = 值

P< 0.05通常用于判断是否存在统计学显著性,它是传统的经验法则,本质上是武断的。但是,如果作者选择使用NHST,我们要求他们遵守这个传统(除非他们预先设定了不同的α水平,并提供了充分的理由支持他们的选择)。对于大于0.05的P值,比如“微弱显著性”和“刚刚没达到统计学显著性”等类似的陈述,再伴随着一些理论上的解释,似乎想要说明零假设已被拒绝,而这种做法是具有误导性的。如果p>0.05或大于预先指定的阈值,那么这些P值就指代不存在统计学显著性,我们要求作者不做修改的如实报道结果。

我们在提交的稿件中遇到的最常见的问题之一是关于不同研究或不同条件之间差异的统计推断,在这些研究中,作者们比较了统计学显著性的水平,而并没有使用正式的统计学检验去比较差异的本身。在2006年的一篇文章中,对于阐述为什么“显著性和非显著性之间的差异本身并不具有统计学显著性”这个问题,Gelman和Stern提供了令人信服的解释。使用显著性水平比较效应估计值是不恰当的,我们要求作者给出差异存在的统计学证据。

如果作者进行多重比较,我们希望他们可以使用适合其数据和多重比较的数量的校正方法(例如:Bonferroni,Benjamini-Hochberg,family-wise error rate or false-discovery rate)。这种校正是统计分析必不可少的一部分,并且,所有结果的解释都应基于校正的P值。

我们根据研究问题的重要性、是否对于交叉学科人员来说有价值以及证据的实质性这三个因素从而确定是否选择外审和发表,而不是基于研究结果。这意味着我们会发表主要结果为阴性的研究。对于阴性结果的研究,我们要求作者不要将缺乏证据作为否定某个事物存在的证据。到目前为止,没有统计检验可以证明不存在某个效应。像“X和Y之间没有关联”或“X对Y没有影响”这样的陈述是不准确的,最好修改为“[没有或很少]可信的X和Y之间的关联证据”或“[没有或很少]可信的X影响Y的证据”。

无论主要或者次要结果是否为阴性,如果在文章中对其进行了解释,我们要求作者使用适当的统计方法进行解释(例如,Bayes因子或等效性检验)。

无论研究结果的方向如何,统计功效对于所有研究来说都是至关重要的。统计功效不足的阴性结果是无法进行解释的。如果研究人员没有使用正式的统计方法来预先确定样本大小,并且他们的主要结果为阴性,那么我们会要求他们进行统计功效敏感性分析。在这些分析中,需展示一系列可能的效应量(包含最小的理论上或实践上有意义的效应量)以及它们所对应的统计检验的功效。

目前有许多人呼吁停用统计学显著性或完全放弃NHST。但在这之前,我们需要确保使用NHST的已发表研究做出了有效的统计推断,并且有恰当的解释。

重点总结

  • 作者除了应该报告P值外,应该同时报告统计检验方法、自由度、检验值和P值,并要求作者不做修改的如实报道结果。
  • 即使P值大于0.05,也应该避免绝对化的描述,如X对Y没有影响,相应改为**[没有或很少]可信的X影响Y的证据**。
  • 推荐作者使用适当的统计方法进行解释(例如,Bayes因子或等效性检验)。
  • 作者必须给出差异存在的统计学证据。推荐作者使用适合其数据和多重比较的校正方法(例如:Bonferroni

内容讲解与代码实现

统计检验

在平时的论文撰写中,我们往往报告最多的是p值,之后或许是自由度,很少报告统计检验方法和检验值。让我们来区分这些概念,并用代码实现。

统计检验是一种用于对样本数据进行推断性分析的方法,通常用于确定一个或多个总体参数的值是否符合预期或与其他总体参数存在显著差异。在进行统计检验时,需要设定一个原假设(null hypothesis)和一个备择假设(alternative hypothesis),并根据收集到的样本数据计算出一个检验值(test statistic),然后根据该检验值来判断原假设是否被拒绝或接受。在进行统计检验时,常常需要使用一些与其相关的术语和概念,包括自由度、检验值和P值等。

  • 自由度(degrees of freedom)指的是在进行统计检验时可自由变化的样本数据个数。在进行一些特定的统计检验时,如t检验和卡方检验,自由度的数量是一个重要的参数。(如:对于一个包含n个样本的单样本t检验,自由度的数量为n-1)
  • 检验值(test statistic)是指根据收集到的样本数据计算得出的一个统计量。(如,在进行单样本t检验时,检验值是t值,而在进行卡方检验时,检验值是卡方值)检验值的大小反映了样本数据与原假设之间的偏离程度,因此它是判断原假设是否被拒绝或接受的重要依据。
  • P值(p-value)是指当原假设为真时,检验值与原假设之间的差异出现的概率。P值的大小通常用来衡量样本数据与原假设之间的偏离程度,较小的P值表示样本数据与原假设之间的差异越大,这意味着原假设越不可信,应该被拒绝。通常情况下,如果P值小于事先设定的显著性水平(如0.05),则可以拒绝原假设;反之,如果P值大于显著性水平,则不能拒绝原假设。

这里以一个T检验为例,来说明上述结果:

首先看t分布:t分布是小样本的正态分布,样本量足够大时,其标准差s才能代表总体的标准差σ

总体均值为

总体方差为

样本均值为

样本标准差为

于是就有:

构造t统计量,分子为标准正态分布,分母为卡方分布除以自由度开根号。

卡方分布

这样用样本的方差,且均值统计量应该不会偏移太多,给定显著性水平α,查分布表得到临界值,决定接受零假设。

用下面的R代码,就可以进行双边t检验:

x = rnorm(25, 5)  
t.test(x, mu = 4, alternative='two.sided')

从结果我们可以看到,检验方法为双边t检验,自由度为24,检验值为5.6467,p值为8.171e-06

贝叶斯因子

贝叶斯因子是贝叶斯统计方法在假设检验方面的一个应用,其代表的是当前数据对一个模型的支持程度与对另一个模型程度支持程度的比例。

当科学研究面临着可重复性危机,对NHST(Null Hypothesis Significance Test)的滥用或误用似乎是一个很重要的原因。

目前大多数学者对NHST理解甚少,存在p-hacking(通过修改、剔除不显著的数据来操纵p值达到显著水平)的现象。

p值:我TM做错什么了……

实际上,NHST中用于验证假设的p值并不能解释假设本身。根据美国统计协会(ASA)在2016年的一份声明中对p值的解释:在统计检验当中,p值只能解释数据与假设之间的关系,并不能衡量研究假设为真时的概率(Wasserstein & Lazar, 2016)。

贝叶斯因子用BF10来表示数据支持备择假设(alternative hypothesis,即 H1 )的程度。其中下标的“10”即代表 H1与H0,所以同理,BF01 则代表数据支持原假设(null hypothesis,即 H0 )的程度。

贝叶斯判别表

当前有不少用于做贝叶斯统计的工具,如软件JASP(http://jasp-stats.org)

JASP软件界面

本篇以R的BayesFactor包为例:

以单样本为例

我们使用sleepR 中的数据集来演示单样本 t 检验。这是一个配对设计;有关数据集的详细信息,请参阅?sleep

必须先安装和加载该BayesFactor包,然后才能使用。安装包可以通过多种方式完成,这里不做介绍。安装后,使用library函数加载它:

library(BayesFactor)
data(sleep)

## Compute difference scores
diffScores = sleep$extra[1:10] - sleep$extra[11:20]

## Traditional two-tailed t test
t.test(diffScores)
## One Sample t-test
##
## data: diffScores
## t = -4, df = 9, p-value = 0.003
## alternative hypothesis: true mean is not equal to 0
## 95 percent confidence interval:
## -2.46 -0.70
## sample estimates:
## mean of x
## -1.58```

我们可以使用函数执行此分析的贝叶斯版本.

bf = ttestBF(x = diffScores)
## Equivalently:
## bf = ttestBF(x = sleep$extra[1:10],y=sleep$extra[11:20], paired=TRUE)
bf
## --------------
## [1] Alt., r=0.707 : 17.3 ±0%
##
## Against denominator:
## Null, mu = 0
## ---
## Bayes factor type: BFoneSample, JZS```

bf对象包含贝叶斯因子,在本例中,用于比较备择假设与零假设的贝叶斯因子是 17.3,表示有较强的证据支持。

使用多重比较的校正

当同一个数据集有n次(n>=2)假设检验时,要做多重假设检验校正。

多重检验后P值校正是一种统计学方法,用于调整进行多次统计检验时得到的P值,以降低发生错误(即错误地拒绝原假设)的风险。

你对数据越苛求,数据会越多地向你供认,但在威逼下得到的供词,在科学询查的法庭上是不容许的。——Stephen M.Stigler

在进行多个统计检验时,如果使用标准的显著性水平(例如,P < 0.05)来判断每个检验的结果是否显著,那么进行大量检验的情况下可能会出现误差。因为每个检验都有一定的概率出现错误,这种概率随着进行检验次数的增加而增加。因此,如果进行多个检验而不进行任何校正,可能会导致错误的概率显著增加。

多重检验后P值校正方法的目的是控制错误率,通常是通过降低显著性水平来实现的。常用的多重检验后P值校正方法包括Bonferroni校正、Holm校正、Benjamini-Hochberg校正等。这些方法的基本思想是在保持整体错误率的前提下,对每个检验的显著性水平进行调整,以确保正确地控制整体错误率。

以Nature推荐的Bonferroni为例:

Bonferroni提出,设H0为真,如果进行m次显著性水准为α的假设检验时,犯Ⅰ类错误的累积概率α’不超 过mα,即有Bonferroni不等式成立 :

所以令各次比较的显著性水准为:

其中0.05为原始阈值(也可自行设定为0.01、0.005等)并规定:

时拒绝H0,基于这样的做法,就可以把Ⅰ类错误的累积概率控制在0.05。这种对检验水准进行修正的方法叫做 Bonferroni调整 (Bonferroni adjustment)法。

以tips数据集为例,用python实现Bonferroni校正

观察有以下数据分布(Sun,Sat,Thur和Fri)

import pandas as pd
import scipy.stats as stats
tips = pd.read_csv('./python/seaborn-data-master/tips.csv')
sns.catplot(data=tips, kind='swarm', x='day', y='total_bill', hue='smoker')

接下来观察组“Sun”和组“Sat”是否具有明显差异?

直观上来看,是没有差异的,用KW检验尝试:

stats.kruskal(tips[tips['day'] == 'Sun']['total_bill'], tips[tips['day'] == 'Sat']['total_bill'])

KruskalResult(statistic=0.8460558571594718, pvalue=0.357670516500295)

结果我们得到一个p值,0.35

接下来观察组“Sun”和组“Thur”的差异:

stats.kruskal(tips[tips['day'] == 'Sun']['total_bill'], tips[tips['day'] == 'Thur']['total_bill'])

KruskalResult(statistic=7.7647256569364105, pvalue=0.005327638803962347)

我们得到的p值比刚才的小,0.0053,但能否说明Sun和Thur的差异比Sun和Sat的差异更大?

直观上来看,看图是可以的,但是仅根据P值,不可以,要经过Bonferroni校正:

import scikit_posthocs as sp
sp.posthoc_dunn(tips, val_col='total_bill', group_col='day', p_adjust='bonferroni')

FriSatSunThur
Fri1.0000000.6005540.1665061.000000
Sat0.6005541.0000001.0000000.296409
Sun0.1665061.0000001.0000000.033249
Thur1.0000000.2964090.0332491.000000

校正结果如上表,根据Bonferroni法校正后的p值,能说明Sun和Thur的差异比Sun和Sat的差异更大。

全文

Points of significance

Abstract

The majority of empirical articles that we publish use null-hypothesis significance testing. In most cases, researchers rely on P values to establish the scientific or practical significance of their findings. However, statistical significance alone provides very little information that is useful for making inferences about scientific or policy significance. For this reason, we require authors to provide much more information than just P values — in this Editorial, we explain our requirements.

Statistical significance and P values have been much discussed over the past decade. In 2016, the American Statistical Association published a statement on P values, aiming to dispel some of the misconceptions that surround their use and interpretation1. Despite heightened attention to the misuse of P values, we frequently encounter research that demonstrates the types of misunderstandings that the American Statistical Association statement tried to allay.

In most empirical studies using null-hypothesis significance testing (NHST) that we receive, authors report only the statistical test, degrees of freedom, test value and P value. In some cases, we see only P values and nothing else. This extremely limited information can be misleading2 and in studies with very large sample sizes it is meaningless (as overpowered studies or studies with very large samples can identify statistically significant but trivial effects). We therefore require that authors also report effect sizes and confidence intervals. Reporting of NHST statistics should typically take the following form: statistic (degrees of freedom) = value; P = value; effect size statistic = value; and per cent confidence intervals = values.

The P value threshold of 0.05 for declaring significance is an arbitrary one that is established by convention. However, if authors choose to use NHST, we ask that they abide by the convention (except if they preregistered a different alpha level for their study, providing a robust justification for their choice3). Statements such as 'marginally significant’ and 'just missed statistical significance’ for P values above the threshold of 0.05 that are followed by theoretical interpretations as if the null hypothesis had been rejected are misleading. P values that exceed the conventional or prespecified threshold are simply not statistically significant and we ask that authors report them as such.

One of the most common issues that we encounter in submitted manuscripts is inferences about differences between studies or conditions, where the authors compare statistical significance levels without using formal statistical tests of the difference itself. In a 2006 article, Gelman and Stern provided a compelling explanation as to why “the difference between significant and not significant is not itself statistically significant”4. Using significance levels to compare effect estimates is not appropriate and we ask authors to provide statistical evidence of any argued difference.

If authors carry out multiple comparisons, we expect that they will use a form of adjustment or correction (for example, Bonferroni, Benjamini–Hochberg, family-wise error rate or false-discovery rate) that is appropriate for their data and the number of comparisons they are performing. This correction is an essential part of the analysis (not merely a robustness check) and all interpretations of results should be based on the corrected P values.

We select studies for peer review and publication based on the importance of the research question, the breadth of its potential relevance to a multidisciplinary audience and the substantiveness of the evidence, not on the basis of their results. This means that we publish studies where the main results are null. For studies reporting statistically null results, we ask authors not to interpret the absence of evidence as evidence of absence. There is no statistical test that can demonstrate the absence of an effect. Statements such as 'there is no association between X and Y’ or 'X has no effect on Y’ are inaccurate, and are best revised to read '[no or little] credible evidence of an association between X and Y’ or '[no or little] credible evidence that X affects Y.’

Regardless of whether the main or ancillary results are null, if these results are interpreted in the article we ask that authors use an appropriate statistical method for interpreting them (for example, Bayes factors5 or equivalence tests6).

Power is fundamental for all studies, regardless of the direction of the results. Null results in underpowered studies are uninterpretable. If researchers did not use a formal method to prespecify their sample size and the main results of their study are null, we ask that they perform a power sensitivity analysis7. This should demonstrate the power of their statistical test across a range of possible effect sizes that includes the smallest theoretically or practically meaningful effect size.

There are numerous calls to retire statistical significance or entirely move away from NHST. Until that happens, however, it is important to make sure that published research using NHST makes statistically valid inferences that are appropriately interpreted.

参考

  1. The ASA's Statement on p-Values: Context, Process, and Purpose

  2. 以Cohen's d为例浅谈效应量(Effect size)https://zhuanlan.zhihu.com/p/361984708

  3. 重复测量方差分析中如何计算贝叶斯因子(Bayes Factor)https://zhuanlan.zhihu.com/p/60507889

  4. Theory of ProbabilityTheory of probability. Oxford: UK Oxford University Press. Wagenmakers, E. J., Love, J., Marsman, M., Jamil, T., Ly, A., Verhagen, J., ... & Meerhoff, F. (2018).

  5. Bayesian inference for psychology. Part II: Example applications with JASP. Psychonomic bulletin & review, 25(1), 58-76.

  6. Points of significance. Nat Hum Behav 7, 293–294 (2023). https://doi.org/10.1038/s41562-023-01586-w

  7. Holm, S. (1979). 'A simple sequentially rejective multiple test procedure'. Scandinavian Journal of Statistics. 6 (2): 65–70. JSTOR 4615733. MR 0538597.

  8. Dunn, O. J. (1964). MULTIPLE COMPARISONS USING RANK SUMS. Technometrics, 6(3), 241-&. https://doi.org/10.2307/1266041

为了不让您最关心的内容被湮没
设置星标能看到公众号大图,不会打扰您
快把“地学实践教程”设置为星标吧★
只需三步↓↓
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
当代流行病学大神Rothman:关于P值的18个误读与真相
九成以上研究者或无法正确理解p值
如何理解统计学中的 Power | 宋春林
《统计学导论》课后答案(五六章)||曾五一版
机器学习算法数学基础之——统计与概率论篇(3)
数据分析必掌握的统计学知识
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服