All problems
Gamma Moments Mean Variance
Problem
A Gamma distribution with shape k and rate theta has mean k / theta and variance k / theta^2.
Given the shape and rate, return [mean, variance].
Hint
Both moments scale linearly with the shape.
Test cases
case 1
in: [2,1]
expected: [2,2]
case 2
in: [4,2]
expected: [2,1]
case 3
in: [1,0.5]
expected: [2,4]
Starter codePython
def gamma_moments_mean_variance(shape, rate):
# Your code here
pass3 test cases · run your code against them in the editor