# Finite Mixture Model-Based Analysis of Yarn Quality Parameters
## 2 Materials and Methods
### Theoretical Background of the Gamma Mixture Distribution
#### 2.3.1 EM Algorithm for Gamma Mixture Distribution  
For a set of observations assumed to follow a gamma mixture distribution, the likelihood and logarithmic likelihood functions can be expressed using the density function provided in Equation (36). These are written as Equations (38) and (39), respectively. \[L(X;\theta)=\prod_{i=1}^{n}\sum_{k=1}^{K}\pi_{k}g_{k}(x_{i};\alpha_{k},\beta_ {k}) \tag{38}\]  
\[logL(X;\theta)=\mathbb{\updownarrow}(\theta)=\sum_{i=1}^{n}log\left(\sum_{k= 1}^{K}\pi_{k}g_{k}(x_{i},\alpha_{k},\beta_{k})\right) \tag{39}\]  
With the maximum likelihood estimation (MLE), the estimate \(\hat{\theta}\) defines a sequence of roots of the loglikelihood equation given in Equation (6). Due to the absence of a closed-form solution for the MLE, the parameters of the gamma mixture distribution are estimated using the EM algorithm. The EM algorithm for gamma distributions has been detailed by various researchers [35; 36]. The missing data can be defined as follows:  
\[\mathbf{z}_{ik}=\left\{ \begin{array}{ll}1,&\text{if $i$th observation is from $k$th Gamma distibution \ \ i=1,\ \ldots,\ n and k =1,\ \ldots,\ K}\\ 0,&\text{otherwise}\end{array} \right. \tag{40}\]  
\[z_{i}=(z_{i1},\ \ldots,\ z_{ik})^{T}\]  
Let \(y=(y_{1},\ \ldots,\ y_{n})\) be the augmented data, where \(y_{i}=(x_{i},z_{i}^{T})\). Then, the augumented loglikelihood function can be defined as shown in Equation (41). \[logL_{a}(\theta,y)=\sum_{i=1}^{n}\sum_{k=1}^{K}z_{ik}log\{\pi_{k}g_{k}(x_{i}; \alpha_{k},\beta_{k})\} \tag{41}\]  
Since the missing data \(z_{ik}\) are not observable, the MLE for \(\theta\) does not have a closed-form solution. Rather than directly determining the optimal likelihood estimate, the EM algorithm operates through two core steps, i.e., the expectation (E) step and the maximization (M) step. During the E-step, the expected value of the log-likelihood function is computed concerning the missing data, yielding an estimate of the mean. In the E-step, as previously demonstrated in the context of the Poisson mixture distribution, it is essential to compute \(Q\left(\theta\middle|\theta^{(r)}\right)\) using Equation (11). Then, the conditional expectation of the missing data \(z_{ik}\) is calculated. Given that \(logL_{a}(\theta,y)\) is a linear function of the missing data \(z_{ik}\), the expected value is then substituted into \(logL_{a}(\theta;y)\). These expected values are given in Equation (42). \[p_{ik}^{(r+1)}=E\Big{(}z_{ik}\Big{|}x_{i},\theta^{(r)}\Big{)}=P\Big{(}z_{ik}= 1\Big{|}x_{i},\theta^{(r)}\Big{)}=\frac{\pi_{k}^{(r)}g_{k}(x_{i};\alpha_{k}^{ (r)},\beta_{k}^{(r)})}{\sum_{r=1}^{K}\pi_{k}g_{v}(x_{i};\alpha_{v}^{(r)},\beta _{v}^{(r)})} \tag{42}\]  
where \(p_{ik}^{(r+1)}\) represents the posterior probability that the i-th observation belongs to the k-th gamma component, based on the current parameter estimates \(\theta^{(r)}\). These probabilities are subsequently utilized in the M-step to update the parameter estimates, following a process analogous to that in the Poisson mixture model. Table 2 gives the EM algorithm for the gamma mixture model. In the E-step of the EM algorithm, the probability density function of the gamma mixture distribution (as defined in Equation (35)) is substituted into Equation (43) to calculate the value of \(\hat{p}_{ik}\), which represents the probability that the i-th observation belongs to the k-th gamma component, given the current parameter estimates. In the M-step of the EM algorithm, Equations (44)-(46) represent a constrained optimization problem and can be expressed in the form of Equations (47) and (48). \[\hat{\theta}_{k},\hat{\pi}_{k}=\underset{\theta_{k},\pi_{k}}{\text{argmax}}Q( \theta_{1},\;\ldots,\;\theta_{k},\pi_{1},\;\ldots,\;\pi_{K}) \tag{47}\]  
s.t. \[\sum\limits_{k=1}^{K}\pi_{k}=1 \tag{48}\]  
This optimization problem can be transformed into Equation (49) using the Lagrange multiplier (\(\delta\)).