比较幂律与其他分布

Comparing Power Law with other Distributions

我正在使用 Jeff Alstott 的 Python powerlaw 包来尝试使我的数据符合幂律。 Jeff 的软件包基于 Clauset 等人讨论幂律的论文。

首先,关于我的数据的一些细节:

  1. 是离散的(字数统计数据);
  2. 严重偏左(高偏度)
  3. Leptokurtic(超峰度大于10)

到目前为止我做了什么

df_data 是我的数据框,其中 word_count 是一个包含大约 1000 个单词标记的单词计数数据的系列。

首先我生成了一个 fit 对象:

fit = powerlaw.Fit(data=df_data.word_count, discrete=True)

接下来,我将我的数据的幂律分布与其他分布进行比较 - 即 lognormalexponential lognormal_positivestretched_exponentialtruncated_powerlaw,以及 fit.distribution_compare (distribution_one, distribution_two) 方法。

作为 distribution_compare 方法的结果,我为每个比较获得了以下 (r,p) 元组:

来自 powerlaw 文档:

R : float

The loglikelihood ratio of the two sets of likelihoods. If positive, the first set of likelihoods is more likely (and so the probability distribution that produced them is a better fit to the data). If negative, the reverse is true.

p : float

The significance of the sign of R. If below a critical value (typically .05) the sign of R is taken to be significant. If above the critical value the sign of R is taken to be due to statistical fluctuations.

从幂律分布、指数分布和对数正态分布的比较结果来看,我倾向于说我是幂律分布。

这是关于测试结果的正确 interpretation/assumption 吗?或许我遗漏了什么?

首先,虽然这些方法可能是由我、Cosma Shalizi 和 Mark Newman 开发的,但我们的实现是在 Matlab 和 R 中。我认为您正在使用的 python 实现可能来自 Jeff Alstott 或 Javier del Molino Matamala 或者 Joel Ornstein (all of these are available off my website).

现在,关于结果。似然比检验 (LRT) 不允许您得出结论,您有或没有 power-law 分布。它只是一个模型比较工具,这意味着它会评估幂律是否比某些替代方法更适合您的数据。 (我这样说是因为 LRT 不是拟合优度方法。)因此,即使 power-law 分布比所有替代方案 更受欢迎 ,它也不是意味着您的数据 power-law 分布的。这仅意味着 power-law 模型是 比替代方案更不可怕 的数据统计模型。

要评估 power-law 分布本身是否是统计上合理的模型,您应该计算拟合 power-law 模型的 p 值,使用semi-parametric bootstrap we describe in our paper。如果 p>0.1 power-law 模型比 LRT 的替代方案更受青睐,那么您可以得出相对强烈的支持您的数据遵循 power-law 分布。

回到您的具体结果:您的每个 LRT 比较都会产生一对 (r,p),其中 r 是归一化的对数似然比和 p 是该比率的统计显着性。这里要测试 p 值的是 rsign 是否有意义.如果 LRT 的 p<0.05,则正号表示 power-law 模型受到青睐。查看您的结果,我发现指数和 lognormal_positive 替代方案比 power-law 模型更适合数据。但是,对数正态分布、stretched_exponential 和 truncated_power_law 不是,这意味着这些替代方案与您的 power-law 模型一样糟糕。

如果没有 p-来自 power-law 模型本身的假设检验的值,则 LRT 结果无法完全解释。但即使是部分解释也与 power-law 模式的强烈证据不一致,因为两个非 power-law 模型与这些数据的幂律一样好(坏)。考虑到 right-skewed 您的数据,指数模型确实比幂律差这一事实不足为奇,因此没有什么可写的。