Is this the right equation to compute the likelihood of a normal distribution at a point?

30 Views Asked by At

This wiki gives this equation of maximization of the log-likelihood function.

${\displaystyle \ln {\mathcal {L}}(\mu ,\sigma ^{2})=\sum _{i=1}^{n}\ln f(x_{i}\mid \mu ,\sigma ^{2})=-{\frac {n}{2}}\ln(2\pi )-{\frac {n}{2}}\ln \sigma ^{2}-{\frac {1}{2\sigma ^{2}}}\sum _{i=1}^{n}(x_{i}-\mu )^{2}.}$

This post gives an python implementation for the equation

this python code is adapted from that post to compute the likelihood at a point.

def llnorm(par, data):
    mu, sigma = par
    ll = math.log(2*math.pi*(sigma**2))/2 + np.sum(((data-mu)**2)/(2 * (sigma**2)))
    return ll

this video gives the value of the likelihood of a normal distribution with $\mu = 32, \sigma = 2.5$ at $x=34$, which is approximately equal to 0.12

I put the params in to my function

llnorm([32,2.5],34)

and got 2.155, which is far from the example. Could someone help to analyze this?

1

There are 1 best solutions below

0
On BEST ANSWER

What you are using is log-likelihood.

To compute likelihood, please use this

enter image description here