Learn R Programming

poweRlaw (version 0.30.0)

bootstrap: Estimating the lower bound (xmin)

Description

When fitting heavy tailed distributions, sometimes it is necessary to estimate the lower threshold, xmin. The lower bound is estimated by calculating the minimising the Kolmogorov-Smirnoff statistic (as described in Clauset, Shalizi, Newman (2009)). [object Object],[object Object],[object Object],[object Object]

Usage

bootstrap(m, xmins = NULL, pars = NULL, xmax = 1e+05, no_of_sims = 100,
  threads = 1, seed = NULL)

bootstrap_p(m, xmins = NULL, pars = NULL, xmax = 1e+05, no_of_sims = 100, threads = 1, seed = NULL)

get_KS_statistic(m, xmax = 1e+05)

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

Arguments

Details

When estimating xmin for discrete distributions, the search space when comparing the data-cdf (empirical cdf) and the distribution_cdf runs from xmin to max(x) where x is the data set. This can often be computationally brutal. In particular, when bootstrapping we generate random numbers from the power law distribution, which has a long tail.

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. When calculating the kolmogorov-smirnov, the CDF is caculate up to the maximum value of the data. However, for some data sets and during bootstrapping, very large values can be generated. This may cause both speed and memory problems.

Occassionally, bootstrapping can generate strange situations. For example, all values in the simulated data set less then the xmin value. In this case, the estimated KS statistic will be Inf and the parameter values, NA.

Examples

Run this code
###################################################
# Load the data set and create distribution object#
###################################################
x = 1:10
m = displ$new(x)

###################################################
# Estimate xmin and pars                          #
###################################################
est = estimate_xmin(m)
m$setXmin(est)

###################################################
# Bootstrap examples                              #
###################################################
bootstrap(m, no_of_sims=1, threads=1)
bootstrap_p(m, no_of_sims=1, threads=1)

Run the code above in your browser using DataLab