All problems
Beta Moments Mean Variance
Problem
A Beta(a, b) distribution has mean a / (a + b) and variance a b / ((a + b)^2 (a + b + 1)).
Given a and b, return [mean, variance].
Hint
The sum a + b acts like a concentration parameter.
Test cases
case 1
in: [2,2]
expected: [0.5,0.05]
case 2
in: [1,5]
expected: [0.16666666666666666,0.01984126984126984]
case 3
in: [5,5]
expected: [0.5,0.022727272727272728]
Starter codePython
def beta_distribution_mean_and_variance(a, b):
# Your code here
pass3 test cases · run your code against them in the editor