SkillAgentSearch skills...

PoweRlaw

This package implements both the discrete and continuous maximum likelihood estimators for fitting the power-law distribution to data. Additionally, a goodness-of-fit based approach is used to estimate the lower cutoff for the scaling region.

Install / Use

/learn @csgillespie/PoweRlaw
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<!-- README.md is generated from README.Rmd. Please edit that file -->

The poweRlaw package

codecov.io Downloads CRAN

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).

<figure> <img src="man/figures/figure1.png" alt="Cumulative CDF of the Moby Dick and blackout data sets with line of best fit." /> <figcaption aria-hidden="true">Cumulative CDF of the Moby Dick and blackout data sets with line of best fit.</figcaption> </figure>

Other information

  • Unfortunately, I can no longer commit time to adding new feature If you find bugs, please use the github issue tracker
  • Feel free to submit pull requests
  • Data was originally obtained from Arron Clausett’s website. But this site is no longer available.

Development of this package was supported by Jumping Rivers

View on GitHub
GitHub Stars114
CategoryDevelopment
Updated28d ago
Forks25

Languages

R

Security Score

85/100

Audited on Mar 5, 2026

No findings