【问题标题】:What is sigma clipping? How do you know when to apply it?什么是 sigma 削波?你怎么知道什么时候应用它?
【发布时间】:2018-01-21 20:19:15
【问题描述】:

我正在阅读一本关于 Python 数据科学的书,作者应用“sigma-clipping operation”来删除由于拼写错误而导致的异常值。但是根本没有解释这个过程。

什么是 sigma 裁剪?它是否仅适用于某些数据(例如,在书中用于计算美国的出生率)?

根据正文:

quartiles = np.percentile(births['births'], [25, 50, 75]) #so we find the 25th, 50th, and 75th percentiles
mu = quartiles[1] #we set mu = 50th percentile
sig = 0.74 * (quartiles[2] - quartiles[0]) #???

This final line is a robust estimate of the sample mean, where the 0.74 comes 
from the interquartile range of a Gaussian distribution.

为什么是 0.74?有证据吗?

【问题讨论】:

  • 您的回复无济于事。你读过上面的问题了吗?
  • 你混合了截然不同的问题。 什么是 sigma 裁剪? 在上面的链接中得到了完美的回答。 为什么是 0.74? 和引用的书本与 sigma 裁剪无关,在下面回答。
  • 为什么是 0.74? normal/Gaussian distribution 的一个基本属性是 50% 的值与平均值的最大距离为 0.67 σ(IQR,参见 this imagethis article)。 0.74 = 1 / (2x0.67)。 “稳健”意味着不受异常极值的影响(异常值在 IQR 之外,因此不用于估计 σ)。

标签: python pandas numpy statistics data-science


【解决方案1】:

最后一行是对样本均值的稳健估计,其中 0.74 来自 来自高斯分布的四分位数范围

原来如此……

代码尝试使用四分位距来估计 sigma,以使其对异常值具有鲁棒性。 0.74 是一个校正因子。计算方法如下:

p1 = sp.stats.norm.ppf(0.25)  # first quartile of standard normal distribution
p2 = sp.stats.norm.ppf(0.75)  # third quartile
print(p2 - p1)  # 1.3489795003921634

sig = 1  # standard deviation of the standard normal distribution  
factor = sig / (p2 - p1)
print(factor)  # 0.74130110925280102

在标准正态分布sig==1 中,四分位距为1.35。所以0.74是把四分位距变成sigma的校正因子。当然,这只适用于正态分布。

【讨论】:

    【解决方案2】:

    假设您有一组数据。计算它的中位数m 和它的标准差sigma。对于 a 的某个值,仅保留范围 (m-a*sigma,m+a*sigma) 中的数据,并丢弃其他所有数据。这是 sigma 裁剪的一次迭代。继续迭代预定次数,和/或在 sigma 值的相对减少较小时停止。

    Sigma 裁剪旨在去除异常值,以实现更稳健(即抵抗异常值)的估计,例如,分布的平均值。因此它适用于您希望找到异常值的数据。

    至于 0.74,它来自高斯分布的四分位数范围,如文所述。

    【讨论】:

      【解决方案3】:

      我认为“这最后一行是对样本平均值的强估计”这句话有一个小错字。从之前的证明来看,如果遵循正态分布,我认为最后一行是对出生 1 Sigma 的可靠估计。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2010-11-29
        • 2011-06-09
        • 1970-01-01
        • 2011-08-08
        • 1970-01-01
        • 2019-07-18
        • 1970-01-01
        • 2010-09-10
        相关资源
        最近更新 更多