Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support parametrization of Beta (Mean and variance Beta(μ, σ²)) #1877

Closed
DominiqueMakowski opened this issue Jul 9, 2024 · 1 comment
Closed

Comments

@DominiqueMakowski
Copy link

Folllow up to this thread: https://discourse.julialang.org/t/reparametrized-beta-in-turing-how-to-set-a-prior-that-depends-on-another-parameter/116753/1

Mean-variance Beta parametrization is very common in regression modelling. Althoug the definition is pretty trivial, it would be convenient to natively support it, for instance by adding a method through keywords arguments:

Beta(; μ=0.5, σ²=0.1)

Or simply through a "new" distribution, for instance: MeanVarBeta()

Here's the definition:

function MeanVarBeta(μ, σ²)
    if σ² <= 0 || σ² >= μ * (1 - μ)
        error("Variance σ² must be in the interval (0, μ*(1-μ)=$(μ*(1-μ))).")
    end

    ν = μ * (1 - μ) / σ² - 1
    α = μ * ν
    β = (1 - μ) * ν

    return Beta(α, β)
end
@DominiqueMakowski
Copy link
Author

Actually, A parametrization based on precision phi is much more trivial and allows for parameter independence:

BetaMuPhi(μ, ϕ) = Beta(μ * ϕ, (1 - μ) * ϕ)

The former is probably pointless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant