Skip to content

Commit

Permalink
Merge pull request #78 from juliangehring/develop
Browse files Browse the repository at this point in the history
Release v2.3.0
  • Loading branch information
juliangehring authored Jan 3, 2021
2 parents 98e81d2 + 71201e4 commit 0597ac2
Show file tree
Hide file tree
Showing 16 changed files with 146 additions and 103 deletions.
5 changes: 5 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage:
precision: 1
round: nearest

comment: false
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Testing

on:
- push
- pull_request

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
version:
- '1.0'
- '1'
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
- uses: julia-actions/julia-uploadcodecov@latest
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Documentation

on:
push:
branches:
- master
tags: [v*]
pull_request:

jobs:
Documenter:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-docdeploy@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

11 changes: 11 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Bootstrap.jl News and Changes

## Version 2.3.0

### Changes

- Performance improvements through parameterized types. Contributed by David Widmann (@devmotion) (#66).
- Specialized Jack-Knife estimator. Contributed by David Widmann (@devmotion) (#67).
- Switch to Github Actions for testing and documentation generation (#75).
- Update links to external webpages in the documentation (#75).
- Extend support to `Distributions` v0.24 (#76).


## Version 2.2.1

### Changes
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ uuid = "e28b5b4c-05e8-5b66-bc03-6f0c0a0a06e0"
license = "MIT"
authors = "Julian Gehring"
repository = "https://github.com/juliangehring/Bootstrap.jl"
version = "2.2.1"
version = "2.3.0"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand All @@ -15,7 +15,7 @@ StatsModels = "3eaba693-59b7-5ba5-a881-562e759f1c8d"

[compat]
DataFrames = "0.19, 0.20, 0.21, 0.22"
Distributions = "0.23"
Distributions = "0.23, 0.24"
GLM = "1.3"
StatsBase = "0.33"
StatsModels = "0.6"
Expand Down
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@ Bootstrapping is a widely applicable technique for statistical estimation.
- Bias-corrected and accelerated (BCa) (`BCaConfInt`)


## Package Status

Reports on package builds for all platforms and test coverage are collected on
the [package status page](status.md).

The package uses [semantic versioning](https://semver.org/).


## Installation

The `Bootstrap` package is part of the Julia ecosphere and the latest release
Expand Down Expand Up @@ -136,3 +128,16 @@ requests or issues if you have suggestions for changes, ideas or questions.
the term _bootstrapping_ is also used in different other contexts. You can check
wikipedia for a longer list of
[meanings associated with bootstrapping](https://en.wikipedia.org/wiki/Bootstrapping_(disambiguation)).


## Package Status

[![Documentation](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliangehring.github.io/Bootstrap.jl/stable)

[![DOI](https://zenodo.org/badge/25918430.svg)](https://zenodo.org/badge/latestdoi/25918430)

![Testing](https://github.com/juliangehring/Bootstrap.jl/workflows/Testing/badge.svg)

[![Coverage](https://codecov.io/gh/juliangehring/Bootstrap.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/juliangehring/Bootstrap.jl)

The package uses [semantic versioning](https://semver.org/).
4 changes: 2 additions & 2 deletions docs/src/references.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

* Davison, A. C.: [Bootstrap Methods and Their Application](http://statwww.epfl.ch/davison/BMA/). Cambridge University Press, 1997

* Efron, B.: [Bootstrap Methods: Another Look at the Jackknife](https://projecteuclid.org/euclid.aos/1176344552). The Annals of Statistics 7, no. 1 (January 1979): 1–26. [doi:10.1214/aos/1176344552](http://dx.doi.org/10.1214/aos/1176344552)
* Efron, B.: [Bootstrap Methods: Another Look at the Jackknife](https://projecteuclid.org/euclid.aos/1176344552). The Annals of Statistics 7, no. 1 (January 1979): 1–26. [doi:10.1214/aos/1176344552](https://dx.doi.org/10.1214/aos/1176344552)


# Algorithms

* Gleason, John R. [Algorithms for Balanced Bootstrap Simulations](http://www.jstor.org/stable/2685134). The American Statistician 42, no. 4 (November 1, 1988): 263–66. [doi:10.2307/2685134](http://dx.doi.org/10.2307/2685134)
* Gleason, John R. [Algorithms for Balanced Bootstrap Simulations](https://www.jstor.org/stable/2685134). The American Statistician 42, no. 4 (November 1, 1988): 263–66. [doi:10.2307/2685134](https://dx.doi.org/10.2307/2685134)


# Software
Expand Down
60 changes: 32 additions & 28 deletions src/bootsampling.jl
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
abstract type Model end

struct SimpleModel{T} <: Model
struct SimpleModel{T,A,K} <: Model
class::T
args::Tuple
kwargs::Tuple
args::A
kwargs::K
end

Model(class, args...; kwargs...) = SimpleModel(class, tuple(args...), tuple(kwargs...))
Model(class, args...; kwargs...) = SimpleModel(class, args, kwargs)

struct FormulaModel{T} <: Model
struct FormulaModel{T,A,K} <: Model
class::T
formula::FormulaTerm
args::Tuple
kwargs::Tuple
args::A
kwargs::K
end

Model(class, formula::FormulaTerm, args...; kwargs...) = FormulaModel(class, formula, tuple(args...), tuple(kwargs...))
Model(class, formula::FormulaTerm, args...; kwargs...) =
FormulaModel(class, formula, args, kwargs)

abstract type BootstrapSampling end

Expand Down Expand Up @@ -83,9 +84,9 @@ WildSampling(1000, mammen)
```
"""
struct WildSampling <: BootstrapSampling
struct WildSampling{F} <: BootstrapSampling
nrun::Int
noise::Function
noise::F
end


Expand Down Expand Up @@ -114,30 +115,30 @@ maximumEntropySampling(100, MaximumEntropyCache())
NOTE: Implementation based off [pymeboot](https://github.com/kirajcg/pymeboot) as the original
[R package](https://cran.r-project.org/web/packages/meboot/index.html) is GPL licensed.
"""
struct MaximumEntropySampling <: BootstrapSampling
struct MaximumEntropySampling{T} <: BootstrapSampling
nrun::Int
cache::MaximumEntropyCache
cache::MaximumEntropyCache{T}
end

MaximumEntropySampling(nrun) = MaximumEntropySampling(nrun, MaximumEntropyCache())

abstract type BootstrapSample end

struct NonParametricBootstrapSample{T} <: BootstrapSample
t0::Tuple
t1::Tuple
statistic::Function
struct NonParametricBootstrapSample{T,T0,T1,S,B} <: BootstrapSample
t0::T0
t1::T1
statistic::S
data::T
sampling::BootstrapSampling
sampling::B
end

struct ParametricBootstrapSample{T,M} <: BootstrapSample
t0::Tuple
t1::Tuple
statistic::Function
struct ParametricBootstrapSample{T,M,T0,T1,S,B} <: BootstrapSample
t0::T0
t1::T1
statistic::S
data::T
model::M
sampling::BootstrapSampling
sampling::B
end


Expand Down Expand Up @@ -179,7 +180,10 @@ nvar(bs::BootstrapSample) = nvar(original(bs))

tx(x) = tuple(x...)

zeros_tuple(t, n) = tuple([zeros(typeof(x), n) for x in t]...)
zeros_tuple(t::Tuple, m::Int) = _zeros_tuple(typeof(t), m)
_zeros_tuple(::Type{Tuple{}}, m::Int) = ()
_zeros_tuple(::Type{T}, m::Int) where T <: Tuple =
(zeros(Base.tuple_type_head(T), m), _zeros_tuple(Base.tuple_type_tail(T), m)...)

"""
bootstrap(statistic, data, BasicSampling())
Expand Down Expand Up @@ -249,7 +253,7 @@ end

struct ExactIterator{T}
a::T
k::Int64
k::Int
end

exact(n::Int) = ExactIterator(1:n, n)
Expand Down Expand Up @@ -343,11 +347,11 @@ struct ResidualTerm{S,T,R} <: StatsModels.AbstractTerm
end


StatsModels.modelcols(t::ResidualTerm{S}, data) where {S} =
throw(ArgumentError("ResidualTerm: don't know how to generate model columns for $S"))
StatsModels.modelcols(t::ResidualTerm, data) =
throw(ArgumentError("ResidualTerm: don't know how to generate model columns for $(typeof(t.sampling))"))
StatsModels.modelcols(t::ResidualTerm{ResidualSampling}, data) =
modelcols(t.t, data) + sample!(t.r0, t.r1)
StatsModels.modelcols(t::ResidualTerm{WildSampling}, data) =
StatsModels.modelcols(t::ResidualTerm{<:WildSampling}, data) =
modelcols(t.t, data) + t.sampling.noise(t.r0)

# we only ever create one of these terms after the model has been fit once so we don't
Expand All @@ -360,7 +364,7 @@ bootstrap(statistic, data, model, formula, sampling)
bootstrap(statistic, data, model, formula, Wildsampling(nrun, noise))
"""
function bootstrap(statistic::Function, data::AbstractDataFrame, model::FormulaModel,
sampling::S) where {S <: BootstrapSampling}
sampling::BootstrapSampling)
class = model.class
formula = apply_schema(model.formula, schema(model.formula, data), model.class)

Expand Down
20 changes: 10 additions & 10 deletions src/confint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ BasicConfInt(0.95)
```
"""
struct BasicConfInt <: ConfIntMethod
level::AbstractFloat
struct BasicConfInt{T} <: ConfIntMethod
level::T
end

BasicConfInt() = BasicConfInt(_level)
Expand All @@ -25,14 +25,14 @@ PercentileConfInt(0.95)
```
"""
struct PercentileConfInt <: ConfIntMethod
level::AbstractFloat
struct PercentileConfInt{T} <: ConfIntMethod
level::T
end

PercentileConfInt() = PercentileConfInt(_level)

struct NormalConfInt <: ConfIntMethod
level::AbstractFloat
struct NormalConfInt{T} <: ConfIntMethod
level::T
end


Expand All @@ -46,8 +46,8 @@ NormalConfInt(0.95)
"""
NormalConfInt() = NormalConfInt(_level)

struct BCaConfInt <: ConfIntMethod
level::AbstractFloat
struct BCaConfInt{T} <: ConfIntMethod
level::T
end


Expand All @@ -61,8 +61,8 @@ BCaConfInt(0.95)
"""
BCaConfInt() = BCaConfInt(_level)

struct StudentConfInt <: ConfIntMethod
level::AbstractFloat
struct StudentConfInt{T} <: ConfIntMethod
level::T
end

"""
Expand Down
Loading

2 comments on commit 0597ac2

@juliangehring
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/27252

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v2.3.0 -m "<description of version>" 0597ac20c2b1191955583d4d9827af9804da1583
git push origin v2.3.0

Please sign in to comment.