The method of moments (MOM) estimates parameters by setting the first theoretical moments equal to the empirical moments and solving for the parameters. Compare it with maximum likelihood on two families.
Implement five functions. Each takes a 1D array-like y with at least two distinct values and returns plain floats.
mom_gaussian(y) returns from and .mle_gaussian(y) returns the Gaussian MLE , with the variance.mom_uniform(y) returns for , using
and the root with .mle_uniform(y) returns the maximum likelihood estimate for the same model.uniform_loglik(theta1, theta2, y) returns for the uniform model: when every observation lies in , and float('-inf') otherwise (also when ).