Skip to content

Commit

Permalink
Updates for Julia 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed Aug 4, 2017
1 parent 9424ec8 commit 2334381
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -3,7 +3,7 @@ language: julia
os:
- linux
julia:
- 0.5
- 0.6
- nightly
notifications:
email: false
Expand Down
1 change: 0 additions & 1 deletion README.md
@@ -1,6 +1,5 @@
# Jackknife.jl

[![0.5](http://pkg.julialang.org/badges/Jackknife_0.5.svg)](http://pkg.julialang.org/?pkg=Jackknife)
[![0.6](http://pkg.julialang.org/badges/Jackknife_0.6.svg)](http://pkg.julialang.org/?pkg=Jackknife)
[![Travis](https://travis-ci.org/ararslan/Jackknife.jl.svg?branch=master)](https://travis-ci.org/ararslan/Jackknife.jl)
[![Coveralls](https://coveralls.io/repos/github/ararslan/Jackknife.jl/badge.svg?branch=master)](https://coveralls.io/github/ararslan/Jackknife.jl?branch=master)
Expand Down
2 changes: 1 addition & 1 deletion REQUIRE
@@ -1 +1 @@
julia 0.5
julia 0.6
4 changes: 2 additions & 2 deletions appveyor.yml
@@ -1,7 +1,7 @@
environment:
matrix:
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.4/julia-0.4-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.4/julia-0.4-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"

Expand Down
8 changes: 4 additions & 4 deletions src/Jackknife.jl
Expand Up @@ -9,7 +9,7 @@ Estimate the parameter `estimator(x)` for each subsample of `x`, systematically
omitting each index one at a time. The result is a vector of length `length(x)-1`
of parameter estimates.
"""
function leaveoneout{T<:Real}(estimator::Function, x::AbstractVector{T})
function leaveoneout(estimator::Function, x::AbstractVector{<:Real})
length(x) > 1 || throw(ArgumentError("The sample must have size > 1"))
inds = eachindex(x)
return [estimator(x[filter(j -> j != i, inds)]) for i in inds]
Expand All @@ -22,7 +22,7 @@ end
Compute the jackknife estimate of the variance of `estimator`, which is given as a
function that computes a point estimate when passed a real-valued vector `x`.
"""
function variance{T<:Real}(estimator::Function, x::AbstractVector{T})
function variance(estimator::Function, x::AbstractVector{<:Real})
θ = leaveoneout(estimator, x)
n = length(x)
return Base.var(θ) * (n - 1)^2 / n
Expand All @@ -35,7 +35,7 @@ end
Compute the jackknife estimate of the bias of `estimator`, which is given as a
function that computes a point estimate when passed a real-valued vector `x`.
"""
function bias{T<:Real}(estimator::Function, x::AbstractVector{T})
function bias(estimator::Function, x::AbstractVector{<:Real})
θ = leaveoneout(estimator, x)
return (length(x) - 1) * (mean(θ) - estimator(x))
end
Expand All @@ -46,7 +46,7 @@ end
Compute the bias-corrected jackknife estimate of the parameter `estimator(x)`.
"""
function estimate{T<:Real}(estimator::Function, x::AbstractVector{T})
function estimate(estimator::Function, x::AbstractVector{<:Real})
θ = leaveoneout(estimator, x)
n = length(x)
return n * estimator(x) - (n - 1) * mean(θ)
Expand Down

0 comments on commit 2334381

Please sign in to comment.