Code Monkey home page Code Monkey logo

extremestats.jl's Introduction


This package provides a set of tools for analysing and estimating extreme value distributions. It defines two types, BlockMaxima and PeakOverThreshold, which can be used to filter a collection of values into a collection of maxima.

Given a collection of maxima produced by either model above, one can start estimating heavy-tail distributions and plotting classical extreme value statistics.

Installation

Get the latest stable release with Julia's package manager:

] add ExtremeStats

Usage

Given a collection of values xs (e.g. time series), one can retrieve its maxima:

using ExtremeStats

# find maxima with blocks of size 50
bm = BlockMaxima(xs, 50)

# get values above a threshold of 100.
pm = PeakOverThreshold(xs, 100.)

For the block maxima model, the values xs need to represent a measurement over time, whereas the peak over threshold model does not assume any ordering in the data. Both models are lazy, and the maxima are only returned via a collect call.

Plotting

A few plot recipes are defined for maxima as well as for the original values xs:

using Plots

# mean excess plot
excessplot(xs)

# Pareto quantile plot
paretoplot(xs)

# return level plot
returnplot(xs)

Fitting

Generalized extreme value (GEV) and generalized Pareto (GP) distributions from the Distributions.jl package can be fit to maxima via constrained optimization (maximum likelihood + extreme value index constraints):

using Distributions

# fit GEV to block maxima
fit(GeneralizedExtremeValue, bm)

# fit GP to peak over threshold
fit(GeneralizedPareto, pm)

Statistics

A few statistics are defined:

# return statistics
returnlevels(xs)

# mean excess with previous k values
meanexcess(xs, k)

References

The book An Introduction to Statistical Modeling of Extreme Values by Stuart Coles gives a practical introduction to the theory. Most other books I've encountered are too theoretical or expose topics that are somewhat disconnected.

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.