Last active
May 23, 2017 02:48
-
-
Save manashmandal/4895a19660ae8656e9538f63a3b4b5f9 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 matplotlib.pyplot as plt | |
import numpy as np | |
def likelihood(theta): | |
return theta**7 * (1 - theta)**3 | |
thetas = np.linspace(0, 1, 100) | |
L = [likelihood(thetas[i]) for i in range(len(thetas))] | |
theta_for_maximum_likelihood = thetas[np.argmax(L)] | |
plt.plot(thetas, L) | |
plt.xlabel("Values of " + r"$\theta$") | |
plt.ylabel("Likelihood " + r"$L(y | k=7, n=10; \theta)$") | |
plt.xticks(list(plt.xticks()[0]) + [theta_for_maximum_likelihood]) | |
plt.axvline(theta_for_maximum_likelihood) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment