# Analysis of Influencing Characteristics of Biochars for Ammonium Adsorption
## 2 Materials and Methods
### Expectation Maximization  
To determine which variables may be correlated with an increase in adsorption capacity, the Pearson correlation coefficient was computed between adsorption capacity and all other variables of interest. This implicitly assumes that all measured variables are drawn from a multivariate normal distribution. Though this is an unrealistic assumption for the physical processes involved, it should serve well for identifying which variables are important to investigate further. However, only some of the variables of interest are considered by individual studies in the literature and, as a result, much of the data are missing. Many methods for handling missing data in statistical analyses have been proposed; we perform maximum likelihood estimation using expectation maximization (EM) [50]. EM is an iterative algorithm which provides better estimates than simpler methods such as mean imputation [51]. Each set of reported measurements is treated as a vector in \(\mathrm{x_{i}}\in\mathbb{R}^{40}\). The set of N reported measurements from the literature is denoted \(\mathrm{X}=\{\mathrm{x_{1}},\ldots,\mathrm{x_{N}}\}\) where \(\mathrm{x_{i}}\in\mathbb{R}^{40\times\mathrm{N}}\). However, as mentioned, only some elements of this vector are observed by every reference work. Assuming that the data are drawn from a multivariate normal distribution, EM was used to obtain an iterative maximum likelihood estimate of the mean \(\mu\) and covariance \(\Sigma\) of this distribution. Then, the maximum likelihood estimate of the covariance was used to calculate pairwise correlations between adsorption capacity and the other variables of interest. Let  
\[\mathcal{L}\Big{(}\mu,\Sigma;\{\mathrm{x_{i}}\}_{i=1}^{\mathrm{N}}\Big{)}= \prod_{i=1}^{\mathrm{N}}\mathrm{p_{X}}(\mathrm{x_{i}}\,|\mu,\Sigma)\]  
be the likelihood of parameters \(\mu\) and \(\Sigma\) given the observations, where \(\mathrm{p_{X}}\) is the probability density of of \(\mathrm{X}\). The maximum likelihood estimate of the distribution parameters can be determined by maximizing the marginal likelihood of the data available from the reference works:  
\[\mathcal{L}\Big{(}\mu,\Sigma;\{\mathrm{x_{a_{i}}}\}_{i=1}^{\mathrm{N}}\Big{)} =\prod_{i}^{\mathrm{N}}\int\mathrm{p_{X_{a}}}_{\mathrm{x_{m}}}\Big{(} \mathrm{x_{a_{i}}}\,|\,\chi_{\mathrm{m_{i}}}\,\mu,\Sigma\Big{)}\mathrm{p_{X_ {m}}}(\mathrm{x_{m_{i}}}\,|\,\mu,\Sigma)\mathrm{d}\mathrm{x_{m_{i}}}.\]  
Given an initial estimate \(\mu^{(0)}\) and \(\Sigma^{(0)}\), the EM-algorithm is typically broken into two steps. The expectation step where we define \(\mathrm{Q}(\mu,\,\Sigma\Big{|}\mu^{(\mathrm{k})},\Sigma^{(\mathrm{k})})\) as the expected value of the log-likelihood  
\[\mathrm{Q}\Big{(}\mu,\,\Sigma|\mu^{(\mathrm{k})},\Sigma^{(\mathrm{k})}\Big{)} =\mathbb{E}_{\mathrm{X_{m}}|\mathrm{X_{a}},\mu^{(\mathrm{k})},\Sigma^{( \mathrm{k})}}\Big{[}\log\mathcal{L}\Big{(}\mu,\Sigma;\{\mathrm{x_{a_{i}}}\}_{ i=1}^{\mathrm{N}},\{\mathrm{x_{m_{i}}}\}_{i=1}^{\mathrm{N}}\Big{)}\Big{]},\]  
and the maximization step where the distribution parameters are updated:  
\[\Big{(}\mu^{(\mathrm{k}+1)},\Sigma^{(\mathrm{k}+1)}\Big{)}=\underset{\mu, \Sigma}{\mathrm{argmin}}\mathrm{Q}\Big{(}\mu,\,\Sigma|\mu^{(\mathrm{k})}, \Sigma^{(\mathrm{k})}\Big{)}.\]Under the assumption that X is a multivariate normal random variable, this simplifies to the following procedure:  
1. Begin with an initial estimate \(\mu^{(0)},\Sigma^{(0)}\);
2. For every reference work i = 1,..., N, impute the missing data \(x_{m_{i}}\) with the mean of the conditional distribution \(p\Big{(}x_{m_{i}}\,|\,x_{a_{i}},\mu^{(k)},\Sigma^{(k)}\Big{)}\), explicitly: \[x_{m_{i}}^{(k)}=\mu_{m_{i}}^{(k)}+\Sigma_{m_{i}a_{i}}^{(k)}\Sigma_{a_{i}a_{i} }^{(k)\,-1}\Big{(}x_{a_{i}}-\mu_{a_{i}}^{(k)}\Big{)};\]
3. Compute an updated estimate of the distribution parameters \(\mu^{(k+1)},\Sigma^{(k+1)}\).