I'm trying to ensure the the method of calculating log likelihood for a model produced using mixtools vs a model produced using MLE estimates of mu and sigma are the same. The best way I can think of doing this is to write my own function to calculate log likelihood.
The first model, produced by mixtools' normalmixEM function, is set to be a mixture of two gaussians. I'm struggling to find how log likelihood is calculated in the case of mixtures, taking into account the lambda values of each gaussian (i.e. its "contribution").
The second model is set to be a single gaussian whose parameters are estimated by using simple MLE estimates for mu and sigma based on the data.
I've seen it suggested that the likelihood can be calculated for a single gaussian using the call:
I'm not sure how this call is the log likelihood, given I know about how LL is calculated.
Can someone confirm whether this actually gives me the LL, and if so, how I can integrate this method of calculating LL with a mixture of two gaussians?
Thanks in advance!