Coder Social home page Coder Social logo

maximumlikelihoodpower.jl's Introduction

MaximumLikelihoodPower

Linux, OSX: Build Status   Windows: Build Status       Coverage Status codecov.io

Physicists love power laws. But, they don't always use the best methods for extracting powers from empirical data.

Notebook example

Here is a notebook using MaximumLikelihoodPower.jl (this notebook is in the Notebooks folder in this distribution).

Command-line example

import MaximumLikelihoodPower
const MLE = MaximumLikelihoodPower

julia> seed = 11; α = 0.5;

# Get 10^6 samples from the Pareto distribution
julia> data = MLE.Example.makeparetodata(α, seed);

# Minimize the Kolmogorov-Smirnov statistic
# The second value returned is the minimizing alpha
julia> MLE.scanKS(data, range(.4, length=11, stop=.6))
3-element Array{Float64,1}:
 0.48
 0.5
 0.52

Functions

mle

    (estimate, stderr) = mle(data::AbstractVector)

Return the maximum likelihood estimate and standard error of the exponent of a power law applied to the sorted vector data.

KSstatistic

    KSstatistic(data::AbstractVector, alpha) --> Float64

Return the Kolmogorov-Smirnov statistic comparing data to a power law with power alpha. The elements of data are assumed to be unique. Minimizing the KS statistic over alpha is another way to estimate the parameter of the sample distribution. See testKS in the test directory.

scanKS(data, powers)

Compute the Kolmogorov Smirnov statistic for several values of α in the iterator powers. Return the value of α that minimizes the KS statistic and the two neighboring values.

mleKS

    mleKS{T<:AbstractFloat}(data::AbstractVector{T})

Return the maximum likelihood estimate and standard error of the exponent of a power law applied to the sorted vector data. Also return the Kolmogorov-Smirnov statistic. Results are returned in an instance of type MLEKS.

scanmle

    scanmle(data::AbstractVector; ntrials=100, stderrcutoff=0.1, useKS=false)

Perform mle approximately ntrials times on data, increasing xmin. Stop trials if the stderr of the estimate alpha is greater than stderrcutoff. Return an object containing statistics about the scan.

comparescan

    comparescan(mle::MLEKS, i, data, mlescan::MLEScan)

compare the results of MLE estimation mle to record results in mlescan and update mlescan.

Reference

Clauset, A., Shalizi, C. R., & Newman, M. E. J. (2009). Power-Law Distributions in Empirical Data. SIAM Review, 51(4), 661–703. http://dx.doi.org/10.1137/070710111, https://arxiv.org/abs/0706.1062

maximumlikelihoodpower.jl's People

Contributors

jlapeyre avatar juliatagbot avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.