1

I have the following are the sample data set. The first column is the serial number and column 2 is data.

Using R, I'm trying to find the xmin, alpha and pvalue. The above data set is discrete, the values are large and treating the data as continuous. For some reason R is not able give proper output for est= estimate_xmin(). Here is the same code.

> 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"
> 

Please let me know if Im missing something. Thanks in advance.

user128956
  • 123
  • 1
  • 14

1 Answers1

2

estimate_xmin has an optional argument xmax:

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

From the documentation:

To speed up computations for discrete distributions it is sensible to put an upper bound, i.e. xmax or explicitly give values of where to search, i.e. xmin.

Since the minimum value in your sample is larger than the default value of xmax , estimate_xmin can't find xmin, unless the upper bound xmax is increased suffiently:

> 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
mra68
  • 2,960
  • 1
  • 10
  • 17