EM algorithm for maximum of 2 normal distribution

58 Views Asked by At

Let $X_i \sim N(\mu_1,\sigma^2), Y_i \sim N(\mu_2,\sigma^2)$

$O_i = \max(X_i,Y_i)$

i need to find $\mu_1, \mu_2$ using EM

my attempt:

first i defined $Z_i = \left\{\begin{matrix} 1, ~ X_i \ge Y_i \\ 0, ~ X_i < Y_i \end{matrix}\right.$

we can assume we know Z

there for: $O_i = X_i*Z_i + Y_i * (1-Z_i)$

$L(O,Z) = \Pi f_x^{z_i} f_y^{z_i} p^{z_i} (1-p)^{1-z_i} \Rightarrow l :=log-likelihood = ∑z_i ln⁡(p)+n-∑z_i ln⁡(1-p)+nln(2√π σ)-\frac{(∑(o_i-μ_1 )^2 z_i+ (o_i-μ_2 )^2 (1-z_i)}{2σ} $

where $ p = P(Z=1) = P(Y-X\le0) =P(N(μ_2-μ_1,2 σ^2)≤0)$

E stage:

let $e_i=E(Z_i |O_i=k)$

$Q = E(l│O)=∑e_i ln⁡(p)+n-∑e_i ln⁡(1-p)+nln(2√π σ)-\frac{(∑(o_i-μ_1 )^2 e_i+ (o_i-μ_2 )^2 (1-e_i)}{2σ}$

M stage:

$\frac{\partial Q}{\partial \mu_1 } = \frac{\sum(O_i + \mu_1)e_i}{\sigma} = 0 \iff \mu_1 = \frac{\sum O_i e_i }{\sum e_i}$

$\frac{\partial Q}{\partial \mu_2 } = \frac{\sum(O_i + \mu_2)(1-e_i)}{\sigma} = 0 \iff \mu_2 = \frac{\sum O_i (1-e_i) }{\sum (1-e_i)}$

i do does stages until Q starts to converge

i tried this with some given values but the results were wrong, where did i go wrong in my calculations? who should i solve this?