# Four-parameter beta distribution

Hi all,

The standard Beta distribution has as support the [0, 1] interval. However, there is also a four-parameter version, which allows one to specify an arbitrary minimum and maximum. R has the function Beta_ab for this. I can’t find a Julia equivalent in the Distributions.jl package. Does anyone know whether such an equivalent exists?

1 Like

I don’t know (and wouldn’t know). Yes, it doesn’t seem to be in that package. I looked at the code and docs, and realized there’s e.g. a Noncentralbeta distribution, and looking up beta didn’t find it. At first I thought it missing from the docs, but searching for a prefix like “non” finds that. “Four” didn’t find what you want.

Looking at the formula, and knowing it’s a simple transformation, I’m not sure it would be that difficult to make:

I thought Distributions.jl was extremely good, with almost everything under the sun (and I really want Julia, and that package, to be as good as possible, as an R replacement). There are however a lot of distributions out there.

At least you can call all R code with RCall.jl (it also has an R mode), so would that be helpful (enough), as a workaround?

I didn’t look at the R code itself (it’s also GPL, and I know people even avoid looking if they want to translate). I don’t think you actually need to look.

Thank you. It’s unfortunate. Yes, I could use RCall.jl, but then I don’t think I could use the distribution as input for a mixture distribution (which is what I need).

I’m not very familiar with Distributions.jl, but from some experimenting I just did with the package I think it is safe to assume that the four-parameter distribution \mathrm{Beta}(\alpha, \beta, a, b), with support [a, b], can be defined in terms of the standard Beta distribution as (b - a) \times \mathrm{Beta}(\alpha, \beta) + a. (Please correct me if wrong.)

2 Likes

According to wikipedia that is correct. Beta distribution - Wikipedia

Just remember that the moments will also shift as a result (mean is no longer simply \alpha / (\alpha + \beta)).

Thank you for confirming.