【问题标题】:Unable to estimate xmin, alpha for large dataset using PoweRlaw无法使用 PoweRlaw 估计大型数据集的 xmin、alpha
【发布时间】:2015-09-16 03:47:07
【问题描述】:

我有以下是样本数据集。第一列是序列号,第二列是数据。

使用 R,我试图找到 xmin、alpha 和 pvalue。上述数据集是离散的,值很大,将数据视为连续的。由于某种原因,R 无法为est= estimate_xmin() 提供正确的输出。这是相同的代码。

> library('poweRlaw')
> m_bl = conpl$new(sample_data$V1)
> est = estimate_xmin(m_bl)
> m_bl$setXmin(est)
Warning message:
In min(which(internal[["dat"]] >= (x - .Machine$double.eps^0.5))) :
  no non-missing arguments to min; returning Inf
> 
> est
$KS
[1] Inf

$xmin
[1] NA

$pars
[1] NA

attr(,"class")
[1] "estimate_xmin"
> 

如果我遗漏了什么,请告诉我。提前致谢。

【问题讨论】:

    标签: r power-law


    【解决方案1】:

    estimate_xmin 有一个可选参数xmax

    estimate_xmin(m, xmins = NULL, pars = NULL, xmax = 1e+05)

    来自文档:

    为了加快离散分布的计算速度,明智的做法是 设置一个上限,即 xmax 或显式给出 where 的值 搜索,即 xmin。

    由于您的样本中的最小值大于 xmax 的默认值 , estimate_xmin 找不到 xmin,除非上限xmax 足够大:

    > library('poweRlaw')
    
    > m_bl = conpl$new(sample_data$V1)
    
    > #==========================================
    > est = estimate_xmin(m_bl)  
    
    > m_bl$setXmin(est)
    Warning in min(which(internal[["dat"]] >= (x - .Machine$double.eps^0.5))) :
      no non-missing arguments to min; returning Inf
    
    > #------------------------------------------
    > est = estimate_xmin(m_bl,xmax=3e+5)  
    
    > m_bl$setXmin(est)
    Warning in min(which(internal[["dat"]] >= (x - .Machine$double.eps^0.5))) :
      no non-missing arguments to min; returning Inf
    
    > #------------------------------------------
    > est = estimate_xmin(m_bl,xmax=5e+5)  
    
    > m_bl$setXmin(est)
    
    > #------------------------------------------
    > est = estimate_xmin(m_bl,xmax=Inf)  
    
    > m_bl$setXmin(est)
    
    > #==========================================
    > m_bl
    Reference class object of class "conpl"
    Field "xmin": 
    [1] 11082439
    Field "pars": 
    [1] 15.83368
    Field "no_pars": 
    [1] 1
    

    【讨论】:

    • 我已经在 github 网站上添加了一个注释,我会尝试修复下一个版本。谢谢
    猜你喜欢
    • 2020-05-05
    • 1970-01-01
    • 2016-12-06
    • 2019-05-25
    • 2020-05-19
    • 1970-01-01
    • 2019-08-14
    • 2020-08-11
    • 2017-02-12
    相关资源
    最近更新 更多