Skip to content

Commit

Permalink
ENH: Bootstrap framework
Browse files Browse the repository at this point in the history
Introduces a bootstrap framework for use by multiple comparison procedures
  • Loading branch information
bashtage committed Sep 18, 2014
1 parent 4a45e50 commit b712104
Show file tree
Hide file tree
Showing 12 changed files with 891 additions and 65 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Documentation Status](https://readthedocs.org/projects/arch/badge/?version=latest)](https://readthedocs.org/projects/arch/?badge=latest)
[![Documentation Status](https://readthedocs.org/projects/arch/badge/?version=latest)](http://arch.readthedocs.org/en/latest/)
[![CI Status](https://travis-ci.org/bashtage/arch.svg?branch=master)](https://travis-ci.org/bashtage/arch)
[![Coverage Status](https://coveralls.io/repos/bashtage/arch/badge.png?branch=master)](https://coveralls.io/r/bashtage/arch?branch=master)

Expand All @@ -11,20 +11,20 @@ This is a work-in-progress for ARCH and related models, written in Python
## What is this repository for?

* Mean models
* Constant mean
* Heterogeneous Autoregression (HAR)
* Autoregression (AR)
* Zero mean
* Models with and without exogensou regressors
* Constant mean
* Heterogeneous Autoregression (HAR)
* Autoregression (AR)
* Zero mean
* Models with and without exogenous regressors
* Volatility models
* ARCH
* GARCH
* TARCH
* EGARCH
* EWMA/RiskMetrics
* ARCH
* GARCH
* TARCH
* EGARCH
* EWMA/RiskMetrics
* Distributions
* Normal
* Student's T
* Normal
* Student's T

## Examples

Expand Down
3 changes: 2 additions & 1 deletion arch/bootstrap/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
__author__ = 'kevin.sheppard'
from .base import IIDBootstrap, CircularBlockBootstrap, MovingBlockBootstrap, \
StationaryBootstrap
23 changes: 23 additions & 0 deletions arch/bootstrap/_samplers.pyx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import numpy as np
cimport numpy as np
cimport cython

__all__ = ['harch_recursion','arch_recursion','garch_recursion',
'egarch_recursion']

@cython.boundscheck(False)
@cython.wraparound(False)
@cython.cdivision(True)
def stationary_bootstrap_sample(int[:] indices,
double[:] u,
double p):
cdef Py_ssize_t num_items, i
num_items = indices.shape[0]

for i in range(1, num_items):
if u[i] > p:
indices[i] = indices[i - 1] + 1
if indices[i] == num_items:
indices[i] = 0

return indices
14 changes: 14 additions & 0 deletions arch/bootstrap/_samplers_python.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from __future__ import absolute_import, division
from ..compat.numba import jit


@jit
def stationary_bootstrap_sample(indices, u, p):
num_items = indices.shape[0]
for i in range(1, num_items):
if u[i] > p:
indices[i] = indices[i - 1] + 1
if indices[i] == num_items:
indices[i] = 0

return indices
Loading

0 comments on commit b712104

Please sign in to comment.