import numpy as np
import seaborn as sns
from scipy.stats import beta
import matplotlib.pyplot as plt
data = np.linspace(1,20,20)
lambd = 1
def f_hat(n):
return (pow(lambd, 2)*(18*n + 1))/(9*pow(n,2))
def f_tilde(n):
return (3*pow(lambd, 2)) / (2*n)
y_tilde = [f_tilde(x) for x in data]
y_hat = [f_hat(x) for x in data]
plt.title("MSE of lambda_tilde & lambda_hat")
sns.lineplot(x = data, y = y_tilde, label = "y-tilde")
sns.lineplot(x = data, y = y_hat, label = 'y-hat')
plt.show()
r = np.linspace(0,1,100)
prior = beta.pdf(r, 2, 3)
posterior = beta.pdf(r, 15, 10)
sns.lineplot(x = r, y = prior, label = 'Prior')
sns.lineplot(x = r, y = posterior, label = 'Posterior')
plt.show()