Learn R Programming

⚠️There's a newer version (0.80.0) of this package.Take me there.

The poweRlaw package

This package implements both the discrete and continuous maximum likelihood estimators for fitting the power-law distribution to data using the methods described in Clauset et al, 2009. It also provides function to fit log-normal and Poisson distributions. Additionally, a goodness-of-fit based approach is used to estimate the lower cut-off for the scaling region.

The code developed in this package was influenced from the python and R code found at Aaron Clauset’s website. In particular, the R code of Laurent Dubroca and Cosma Shalizi.

To cite this package in academic work, please use:

Gillespie, C. S. “Fitting heavy tailed distributions: the poweRlaw package.” Journal of Statistical Software, 64(2) 2015. (pdf).

For a different way of handling powerlaw type distributions, see

Gillespie, C.S. " Estimating the number of casualties in the American Indian war: a Bayesian analysis using the power law distribution." Annals of Applied Statistics, 2017. (pdf)

Installation

This package is hosted on CRAN and can be installed in the usual way:

install.packages("poweRlaw")

Alternatively, the development version can be install from from github using the devtools package:

install.packages("devtools")
devtools::install_github("csgillespie/poweRlaw")

Getting Started

To get started, load the package

library("poweRlaw")

then work through the four vignettes (links to the current CRAN version):

Alternatively, you can access the vignettes from within the package:

browseVignettes("poweRlaw")

The plots below show the line of best fit to the Moby Dick and blackout data sets (from Clauset et al, 2009).

Other information

  • If you have any suggestions or find bugs, please use the github issue tracker
  • Feel free to submit pull requests

Development of this package was supported by Jumping Rivers

Copy Link

Version

Install

install.packages('poweRlaw')

Monthly Downloads

6,971

Version

0.70.6

License

GPL-2 | GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Colin Gillespie

Last Published

April 25th, 2020

Functions in poweRlaw (0.70.6)

dplcon

The continuous power-law distribution
dist_cdf

The cumulative distribution function (cdf)
get_bootstrap_sims

Estimating the lower bound (xmin)
estimate_pars

Estimates the distributions using mle.
dpldis

Discrete power-law distribution
dist_pdf

The probability density function (pdf)
dist_rand

Random number generation for the distribution objects
bootstrap_moby

Example bootstrap results for the full Moby Dick data set
get_ntail

Values greater than or equal to xmin
compare_distributions

Vuong's test for non-nested models
get_KS_statistic

Deprecated function
lines,distribution-method

Generic plotting functions
native_american

Casualties in the American Indian Wars (1776 and 1890)
dist_all_cdf

The data cumulative distribution function
dist_ll

The log-likelihood function
plot.bs_xmin

Plot methods for bootstrap objects
get_n

Sample size
population

City boundaries and the universality of scaling laws
moby

Moby Dick word count
poweRlaw-package

The poweRlaw package
show,distribution-method

Generic show method for distribution objects
swiss_prot

Word frequency in the Swiss-Prot database
conlnorm-class

Heavy-tailed distributions