Skip to content
DeepForgeby svx
All problems
HardProbabilitypr-140

Bias and MSE of the Uniform MLE

Problem

For X_1, ..., X_n iid Uniform(0, theta), the MLE is M = max(X_i). Return [bias, mse]:

bias = E[M] - theta = -theta / (n + 1) MSE = bias^2 + Var(M) = 2 * theta^2 / ((n + 1) * (n + 2)).

Return [0.0, 0.0] for n <= 0 or theta <= 0.

Hint

E[M] = n * theta / (n + 1) and Var(M) = n * theta^2 / ((n + 1)^2 * (n + 2)).

Test cases

case 1
in: [1,1]
expected: [-0.5,0.3333333333333333]
case 2
in: [2,1]
expected: [-0.3333333333333333,0.16666666666666666]
case 3
in: [5,2]
expected: [-0.3333333333333333,0.19047619047619047]
case 4
in: [0,1]
expected: [0,0]
Starter codePython
def mle_uniform_max_bias_mse(n, theta):
    # Your code here
    pass

4 test cases · run your code against them in the editor