Skip to content

Commit

Permalink
Return missing in mcse_bm instead of throwing an error (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
devmotion authored Aug 20, 2020
1 parent fa6757a commit 72ada49
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ uuid = "c7f686f2-ff18-58e9-bc7b-31028e88f75d"
keywords = ["markov chain monte carlo", "probablistic programming"]
license = "MIT"
desc = "Chain types and utility functions for MCMC simulations."
version = "4.0.3"
version = "4.0.4"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand Down
5 changes: 2 additions & 3 deletions src/mcse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ function mcse_bm(x::Vector{<:Real}; size::Integer=100)
n = length(x)
m = div(n, size)
if m < 2
throw(
ArgumentError("iterations are < $(2 * size) and batch size is > $(div(n, 2))")
)
@debug "iterations are < $(2 * size) and batch size is > $(div(n, 2))"
return missing
end
mbar = [mean(x[i * size .+ (1:size)]) for i in 0:(m - 1)]
return sem(mbar)
Expand Down
7 changes: 1 addition & 6 deletions src/stats.jl
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,8 @@ function summarystats(
etype = :bm,
kwargs...
)
# Make some functions.
df_mcse(x) = length(x) < 200 ?
missing :
mcse(cskip(x), etype; kwargs...)

# Store everything.
funs = [meancskip, stdcskip, semcskip, df_mcse]
funs = [meancskip, stdcskip, semcskip, x -> mcse(cskip(x), etype; kwargs...)]
func_names = [:mean, :std, :naive_se, :mcse]

# Subset the chain.
Expand Down

2 comments on commit 72ada49

@devmotion
Copy link
Member 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/19862

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 v4.0.4 -m "<description of version>" 72ada49bc0be5b0eaee354163b3060d2e305e1e7
git push origin v4.0.4

Please sign in to comment.