Possibly a dumb question so forgive me but,
From here:
N = 10000
x = 10 + 2*np.random.randn(N)
y = 5 + x + np.random.randn(N)
def neg_loglike(const,coef,std):
mu = const + coef*x
print(mu.shape)
return -1*stats.norm(mu, std).logpdf(y).sum()
seed = np.array([1,1,1])
res = minimize(neg_loglike, seed, method = 'Nelder-Mead',
options={'disp': True})
mu is an array/vector in this case - so is stats.norm
generating a normal distribution for each value of x? What does it mean for a normal distribution to have multiple means... (clearly I'm not getting this)
Lastly, is a correct interpretation of the optimal values in res.x
that these parameters generate a set of normal distributions that maximize the probability of seeing y in the distribution..?