首页 > 编程知识 正文

样本平均数的假设检验,统计学假设检验的基本步骤是

时间:2023-05-05 11:37:14 阅读:118618 作者:4757

请点击原文阅读,在雀中查看

33559 www.Yu que.com/alipayqgthu1irbf/shark fin/enrz ni

翻译源

3359 machinelearningmastery.com/statistical-hypothesis-tests-in-python-cheat-sheet /

应用机器学习所需的17种统计假设验证的快速参考指南,提供Python的示例代码。

虽然有数百个统计假设检验可用,但只有一小部分子集可能需要在机器学习项目中使用。

在这篇文章中,我们来看看机器学习项目中最受欢迎的统计假设验证手册。 其中有使用Python API的例子。 各项统计检查表现方法一致,包括: 检查的名称

检查的内容。

验证的重要假说。

测试结果怎么说明?

使用测试的Python API。

请注意,如果涉及数据的预期分布和样本大小等假设,则违反某个假设可能会优雅地退化,而不是某个测试的结果立即变得不可用。

一般来说,数据样本必须具有区域代表性,足够大以暴露和分析其分布。

在某些情况下,可以修改数据以满足假设。 例如,通过移除离群值将接近正态分布的值修改为正态分布,或者如果采样具有不同的方差,则在统计测试中使用自由度修改。 这是两个例子。

最后,关于正规性等特定关注点,可能有几种检查方法。 我们不能用统计学得到问题的明确答案; 相反,我们得到了概率的答案。 因此,我们通过考虑问题的不同方式,可以对同一个问题得到不同的答案。 因此,对于数据的一些问题,可能需要进行各种检查。

目录的正规性检查

相关检查

稳定性检查

参数统计假设检验

非参数统计假设检验

lldej检查

D'Agostino's K^2检查

安德森-达林检验

皮尔森相关系数

斯皮尔曼等级相关

Kendall's Rank Correlation

卡方检验

Augmented Dickey-Fuller

kiatkowski-Phillips-Schmidt-shin事件

学生托福考试

配对学生t检验

分散检查(ANOVA ) )。

重复计量方差分析检查

Mann-Whitney U检查

Wilcoxon信号通道检查

Kruskal-Wallis H检验

弗里德曼检验

本教程分为以下五个部分:

1 .规范性检查Normality Tests

本节列出了可用于检查数据是否具有瘦汽车分布的统计测试。

lldej测试Shapiro-Wilk Test假设

说明H0 )样品具有瘦长的汽车分布。

) H1 )样品不具有瘦长的汽车分布。

各样品观测值独立且分布相同()。

Python代码# exampleoftheshapiro-wilknormalitytest

from scipy.stats import shapiro

数据=[ 0.873,2.817,0.121,-0.945,-0.055,-1.436,-0.360,-1.478,-1.637,-1.869]

stat,p=Shapiro (数据) )。

打印(stat=%.3f,p=%.3f ) stat,p ) )

if p 0.05:

可移植高斯(print ) )。

else:

print (可携式notgaussian ) )

详细信息agentleintroductiontonormalitytestsinpython

scipy.stats.shapiro

维基百科Shapiro-wilk test on

D'Agostino's K^2检测D'Agostino's K^2测试数据样本是否具有瘦长的汽车分布。

假说

说明H0 )样品具有瘦长的汽车分布。

) H1 )样品不具有瘦长的汽车分布。

各样品观测值独立且分布相同()。

python code # exampleofthed ' agostino ' sk ^ 2正常测试

from scipy.statsimportnormaltest

DATA=[0.873、2.817、0.121、-0.945、-0.055、-1.478、0.360、-1.478、-1

.637, -1.869]

stat, p = normaltest(data)

print('stat=%.3f, p=%.3f' % (stat, p))

if p > 0.05:

print('Probably Gaussian')

else:

print('Probably not Gaussian')

More InformationA Gentle Introduction to Normality Tests in Python

scipy.stats.normaltest

D’Agostino’s K-squared test on Wikipedia

安德森-达林检验 Anderson-Darling Test测试数据样本是否具有瘦瘦的汽车分布。

假设

解释H0:样本具有瘦瘦的汽车分布。

H1:样本不具有瘦瘦的汽车分布。

每个样本中的观测值都是独立和相同分布的(iid)。

Python Code# Example of the Anderson-Darling Normality Test

from scipy.stats import anderson

data = [0.873, 2.817, 0.121, -0.945, -0.055, -1.436, 0.360, -1.478, -1.637, -1.869]

result = anderson(data)

print('stat=%.3f' % (result.statistic))

for i in range(len(result.critical_values)):

sl, cv = result.significance_level[i], result.critical_values[i]

if result.statistic < cv:

print('Probably Gaussian at the %.1f%% level' % (sl))

else:

print('Probably not Gaussian at the %.1f%% level' % (sl))

More InformationA Gentle Introduction to Normality Tests in Python

scipy.stats.anderson

Anderson-Darling test on Wikipedia

2. 相关性检验 Correlation Tests

This section lists statistical tests that you can use to check if two samples are related.

皮尔逊相关系数 Pearson’s Correlation Coefficient检验两个样本是否有线性关系。

假设

解释H0:两个样本是独立的。

H1:样本之间有 dependency。

每个样本中的观测值都是独立和相同分布的(iid)。

每个样本中的观测值都是正态分布。

每个样本中的观测值具有相同的方差。

Python Code# Example of the Pearson's Correlation test

from scipy.stats import pearsonr

data1 = [0.873, 2.817, 0.121, -0.945, -0.055, -1.436, 0.360, -1.478, -1.637, -1.869]

data2 = [0.353, 3.517, 0.125, -7.545, -0.555, -1.536, 3.350, -1.578, -3.537, -1.579]

stat, p = pearsonr(data1, data2)

print('stat=%.3f, p=%.3f' % (stat, p))

if p > 0.05:

print('Probably independent')

else:

print('Probably dependent')

More InformationHow to Calculate Correlation Between Variables in Python

scipy.stats.pearsonr

Pearson’s correlation coefficient on Wikipedia

斯皮尔曼秩相关 Spearman’s Rank Correlation检验两个样本是否有单调关系(monotonic relationship)。

假设

解释H0:两个样本是独立的。

H1:样本之间有dependency。

每个样本中的观测值都是独立的、同分布的(iid)。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。