Last active
June 30, 2021 16:01
-
-
Save michelkana/1957c2ff7527b2706cd9c2a75dbf1e60 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import numpy as np | |
def f(n): | |
return math.factorial(n) | |
def mle(R, theta): | |
return (f(np.sum(R)) / (np.prod([f(r) for r in R]))) * \ | |
np.prod([theta[i]**R[i] for i in range(len(R))]) | |
# maximum likelihood | |
ml_A = mle(R_A,theta_A) | |
ml_B = mle(R_B,theta_B) | |
print("ML for Product A {:.7f}".format(ml_A)) | |
print("ML for Product B {:.7f}".format(ml_B)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment