# Multiple Factor Analysis Based on NIPALS Algorithm to Solve Missing Data Problems
## 2 Methods
### Multiple Factorial Analysis  
MFA allows analyzing multiple tables formed by (different nature) variable groups from the same set of individuals [28]. MFA is based on the same PCA principles [29] and comprises three steps:  
1. Each group of variables is associated with an individual factor map, which is independently analyzed with PCA for quantitative variable groups and MFA for qualitative ones.
2. This step is called \"weighing\" because the influence of the groups of variables is balanced by assigning a weight or metric to each variable. The same weight is assigned to evaluated variables from the same category, by holding the same structure within the group. This weight is computed considering the first eigenvalue obtained through PCA or MFA from each table of the group of variables. Weight is computed as \(1/\lambda_{1}^{(k)}\), where \(\lambda_{1}^{(k)}\) is the first eigenvalue of the \(k\)th table.
3. A global PCA is computed over a juxtaposed table \(\mathbf{Z}\), taking into account the weights obtained from step 2.  
Inertia Maximization of MFA  
Most of the multivariate analysis methods try to maximize inertia \(I_{\alpha}\) (multivariate variance) on a new orthogonal axis [2]. To do this, a maximization system is proposed that takes into account a constraint of the new axis normalized to \(1\) (\(n_{\alpha}^{-1}\mathbf{M}\mathbf{u}_{\alpha}=1\)).  
MFA inertia for the individual factor map is:  
\[I_{\alpha} = \sum_{i=1}^{n}\omega_{ii}[d(i,G)]^{2} \tag{1}\] \[= \mathbf{\psi}_{\alpha}^{\top}\mathbf{N}\mathbf{\psi}_{\alpha}, \tag{2}\]  
where \(d(i,G)\) is the Euclidean distance between the \(i\)th individual with a gravity center vector \(\mathbf{G}=(\mathbf{x}_{1},\mathbf{x}_{2},\ldots,\mathbf{x}_{p})\) that contains the averages of individual groups; \(\mathbf{N}\) is a diagonal weight matrix of individuals composed by \(\omega_{ii}=1/n\); \(\mathbf{\psi}_{\alpha}=\mathbf{Z}\mathbf{M}\mathbf{u}_{\alpha}\); \(\mathbf{u}_{\alpha}\) is the eigenvector of the \(\alpha\)th factor; and \(\mathbf{M}\) is the metric of the variables, which is the inverse of the first eigenvalue of the matrix associated with the \(k\)th table, i.e., \(\mathbf{M}\) is a diagonal matrix composed by \(1/\lambda_{1}^{(k)}\).  
Then, maximization of inertia \(I_{\alpha}\) is required under the following scheme:  
\[\max\left\{I_{\alpha}\right\} \Leftrightarrow \max\left\{\mathbf{\psi}_{\alpha}^{\top}\mathbf{N}\mathbf{\psi}_{\alpha}\right\} \tag{3}\] \[\Leftrightarrow \max\{\mathbf{u}_{\alpha}^{\top}\mathbf{M}\mathbf{Z}^{\top}\mathbf{N}\mathbf{Z}\mathbf{M} \mathbf{u}_{\alpha}\}, \tag{4}\]  
under constraint \(\mathbf{u}_{\alpha}^{\top}\mathbf{M}\mathbf{u}_{\alpha}=1\). The latter maximization system can be solved by defining the function:  
\[L(\mathbf{u}_{\alpha}) = \mathbf{u}_{\alpha}^{\top}\mathbf{M}\mathbf{Z}^{\top}\mathbf{N}\mathbf{Z}\mathbf{M}\mathbf{u} _{\alpha}-\lambda_{\alpha}(\mathbf{u}_{\alpha}^{\top}\mathbf{M}\mathbf{u}_{\alpha}-1) \tag{5}\] \[= \mathbf{u}_{\alpha}^{\top}\mathbf{M}\mathbf{Z}^{\top}\mathbf{N}\mathbf{Z}\mathbf{M}\mathbf{u} _{\alpha}-\lambda_{\alpha}\mathbf{u}_{\alpha}^{\top}\mathbf{M}\mathbf{u}_{\alpha}+\lambda _{\alpha}. \tag{6}\]  
Then, by equating the following expression to zero:  
\[\frac{\partial}{\partial\mathbf{u}_{\alpha}}L(\mathbf{u}_{\alpha}) = 2\mathbf{Z}^{\top}\mathbf{N}\mathbf{Z}\mathbf{M}\mathbf{u}_{\alpha}-2\lambda_{ \alpha}\mathbf{u}_{\alpha} \tag{7}\] \[= 2(\mathbf{Z}^{\top}\mathbf{N}\mathbf{Z}\mathbf{M}-\lambda_{\alpha})\mathbf{u}_{\alpha}, \tag{8}\]  
the following system of eigenvalues and eigenvectors is obtained:  
\[\mathbf{Z}^{\top}\mathbf{N}\mathbf{Z}\mathbf{M}\mathbf{u}_{\alpha}=\lambda_{\alpha}\mathbf{u}_{\alpha}, \tag{9}\]  
where \(\lambda_{\alpha}\) is the variance for the \(\alpha\)th factor.