Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
fix: beta-binomial numerical instability
Browse files Browse the repository at this point in the history
  • Loading branch information
storopoli committed Dec 3, 2023
1 parent e23bf1b commit 23ec89d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion turing/07-robust_beta_binomial_regression-wells.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ X = standardize(ZScoreTransform, X; dims=1)
y = wells[:, :switch]

# define alternate parameterizations
BetaBinomial2(n, μ, ϕ) = BetaBinomial(n, μ * ϕ, (1 - μ) * ϕ)
# eps() for numerical stability
BetaBinomial2(n, μ, ϕ) = BetaBinomial(n, μ * ϕ, max((1 - μ) * ϕ, eps()))

# define the model
@model function beta_binomial_regression(X, y; predictors=size(X, 2))
Expand Down

0 comments on commit 23ec89d

Please sign in to comment.