3
$\begingroup$

Here EM algorithm manually implemented, there's a question of the implementation in R of the EM algorithm for 2 mixed gaussians. The answer has a supposedly correct implementation.

However, don't the lines

  sigma1 <- sum(tau1*(x-mu1)^2)/sum(tau1)
  sigma2 <- sum(tau2*(x-mu2)^2)/sum(tau2)

estimate the variance? In the next iteration of the loop, they use these values to create normal random variables:

dnorm(dat,mean=mu1,sd=sigma1)
dnorm(dat,mean=mu2,sd=sigma2)

so they are assuming that the variables represent the standard deviation. I don't understand why the algorithm works. Should it? Why?

$\endgroup$
1
  • 1
    $\begingroup$ In the post you put in link, there is the answer to your question. Yes it is false here. You have variance in the first step then it is standard deviation in the argument of dnorm. $\endgroup$
    – PauZen
    Commented Jul 11, 2019 at 22:03

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.