Display values from Distributions

I’m trying to assign values of Beta(a,b) function in Distributions package to x but the value is not printing in console.

using Distributions
x = Beta(1,2)

Gives me

julia> x
Beta{Float64}(α=1.0, β=2.0)

How can I assign the value to x and print it on console?

When you call Beta(1,2) you are creating a distribution with parameters alpha 1 and beta 2.

Do you want to randomly sample from that distribution instead?

x = rand(Beta(1,2),10)

If not, can you clarify what you expected this to be doing?

1 Like

Thank you, I want to print the value of Beta(1,2) value which is 0.5, as an example in R the value of beta function is

> beta(1,2)
[1] 0.5

Ah ok. You want the Beta function, not the Beta distribution.

using SpecialFunctions
x = beta(1,2)

:+1:

4 Likes

thank you, I just found that as well.

A bit more about Beta() the distribution and beta() the special function is in Listing 3.24 pg. 111 in the Statistics with Julia Book Draft.

2 Likes