Git Product home page Git Product logo

blockbootstrap.jl's Introduction

BlockBootstrap.jl

Statistical block bootstrap library for Julia. Created by William Davis and Maggie Avery.

BlockBootstrap.jl is a Julia package for calculating and bootstrapping uncertainties statistics on time-series data.

Theory

The theory used in this package is based off the book “Resampling methods for dependent data” by S.N. Lahiri, 2003, Springer.

Details of theory to be added.

Using the package

There are many notebook example of how to use the package in the ./notebooks/ directory.

Short example

This example is mostly from ./notebooks/BootstrapSDE.ipynb. For a time-series observation, such as a realization of the Ornstein-Uhlenbeck stochastic differential equation,

equation

This solution will look something like the figure below.

Say we want to estimate the parameter equation from the realization, and we also want to find the incertainties on that estimation. Define a function handle that returns the statistic of choice (in this example it is slopeStatisticSet(), and pass it to the block bootstrapping function bootstrapStatistic().

## Calculate the statistic and bootstrap the uncertainties
# Settings
inputData = U;
statisticHandle = slopeStatisticSet;
bootstrapSampleHandle = CBBsample;
blockLength = 1500;
NbootstrapReplicates = 200;

fullDataEstimate, replicateEstimate, resampleIndexBB, resampleDataBB = bootstrapStatistic(
    inputData, statisticHandle, bootstrapSampleHandle, blockLength, NbootstrapReplicates);

Settings are defined as functions to the argument bootstrapStatistic(), see the header of the function for descriptions. The output resampleIndexBB shows how the time indices have been resampled, e.g. see the figure below.

The output fullDataEstimate is the estimate of the statistics, and replicateEstimate is a vector of the statistics for bootstrap replicants, e.g. see the figure below.

TODOs

  • Add more resampling methods.
  • Add more tests for n-dimensional statistics.
  • Resampling scheme for n-dimensional statistics (i.e. Blocks-of-blocks, Politis and Romano, 1992)?
  • Benchmark performance.

Changelog

  • Version 0.1.0 - Introduced version Maggie and I made for group meetings.

References

  • Lahiri, S. K., & Lahiri, S. N. (2003). Resampling Methods for Dependent Data. Springer Science & Business Media.
  • Politis, D. N., & Romano, J. P. (1992). A general resampling scheme for triangular arrays of α-mixing random variables with application to the problem of spectral density estimation. The Annals of Statistics, 1985-2007.

blockbootstrap.jl's People

Contributors

maggieavery avatar williamjsdavis avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

blockbootstrap.jl's Issues

Resample indices are abstract types

Resample indices are abstract types. This is bad for performance:

https://docs.julialang.org/en/v1/manual/performance-tips/#man-performance-abstract-container

Minimum working example:

bootstrapStatistic(
    [1.,2.,3.], 
    sum, 
    CBBsampler, 
    2, 
    5
)

Gives:

BlockBootstrap.bootstrapResult(6.0, [8.0, 9.0, 10.0, 9.0, 8.0], Array[Integer[1, 2, 2, 3], Integer[3, 1, 2, 3], Integer[2, 3, 2, 3], Integer[3, 1, 2, 3], Integer[3, 1, 3, 1]], Array[[1.0, 2.0, 2.0, 3.0], [3.0, 1.0, 2.0, 3.0], [2.0, 3.0, 2.0, 3.0], [3.0, 1.0, 2.0, 3.0], [3.0, 1.0, 3.0, 1.0]])

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.