# Construction of Air Quality Level Prediction Model Based on STEPDISC-PCA-BP
## 2 Materials and Methods
### Methodology
#### 2.2.2 Principle Component Analysis (PCA)  
The PCA method is a linear combination of correlated original factors by orthogonal transformation to obtain fewer uncorrelated comprehensive factors, i.e., principal components, to reflect as much information as possible about the original factors, thus achieving the purpose of data dimensionality reduction. Suppose there are \(n\) samples, each including \(p\) factors, and the original observation data matrix is denoted as \(X\), and each observation is denoted as \(x_{ij}\) (\(i\) = 1, 2, \(\ldots\), \(n\), \(j\) = 1, 2, \(\ldots\), \(p\)), when the range of values of the \(p\) original factors is very different from each other, it is necessary to standardized \(X\) (Equation (1)), denoted as \(X^{*}\).  
\[{x_{ij}}^{*}=\frac{x_{ij}-\overline{x}_{j}}{s_{j}} \tag{1}\]  
Starting from the correlation matrix of \(X\) to calculate the principal components is equivalent to standardizing the original data. The calculation steps are as follows:  
1. Calculate the correlation matrix \(R\) of \(X\) (Equation (2)). \[R=\left(r_{ij}\right)_{p\times p}=\frac{\sum\limits_{k=1}^{n}\left(x_{ij}- \overline{x}_{j}\right)\left(x_{ij}-\overline{x}_{j}\right)}{\sqrt{\sum \limits_{k=1}^{n}\left(x_{ii}-\overline{x}_{j}\right)^{2}}\sqrt{\sum\limits_ {i=1}^{n}\left(x_{ij}-\overline{x}_{j}\right)^{2}}}(i,j=1,2,\ldots,p)\] (2)
2. Calculate the eigenvalues of \(R\) and unit orthogonalized eigenvectors.  
The eigenvalues of \(R\) in descending order are: \(\lambda_{1}\geq\lambda_{2}\geq\ldots\)\(\lambda_{p}\) > 0, and the \(i\)-th principal component is \(F_{i}\). \(\lambda_{i}\) is the variance of \(F_{i}\), and the corresponding orthogonalized unit eigenvector of eigenvalues is denoted as:  
\[a_{1}=\left(\begin{array}{c}a_{11}\\ a_{21}\\ \ldots\\ a_{p1}\end{array}\right),a_{2}=\left(\begin{array}{c}a_{12}\\ a_{22}\\ \ldots\\ a_{p2}\end{array}\right),\ldots,a_{p}=\left(\begin{array}{c}a_{1p}\\ a_{2p}\\ \ldots\\ a_{pp}\end{array}\right)\]  
The \(i\)-th principal component is (Equation (3)):  
\[F_{i}={a_{i}}^{T}X^{*},i=1,2,\ldots,p \tag{3}\]
3. Select the principal components The contribution rate of the principal component \(F_{i}\) is \(\frac{\lambda_{i}}{\sum\limits_{k=1}^{p}\lambda_{k}}\). The cumulative contribution rate of the top \(m\) principal components is \(\frac{\sum\limits_{k=1}^{m}\lambda_{k}}{\sum\limits_{k=1}^{p}\lambda_{k}}\). It can be interpreted that the top \(m\) principal components reflect the amount of the information of the original factors. In general, a cumulative contribution rate greater than 85% includes the main amount of information from the original factor and simplifies the model structure. Therefore, \(m\) is determined with a cumulative contribution rate threshold of 85% [13].  
4. Explain the principal componentsAccording to \(\rho(F_{k},x_{i})=a_{ik}\sqrt{\lambda_{k}}(k,i=1,2,\ldots,p)\), \(a_{ik}\) reflects the correlation between the \(k\)-th principal component and the \(i\)-th original factor, and a reasonable interpretation should be given to the principal component based on some primary factors that play a major role, rather than simply interpreting it as the role of a single factor.  
Calculate the scores of \(n\) samples on \(m\) principal components (Equation (4)):  
\[F_{j}=a_{1j}{X_{1}}^{*}+a_{2j}{X_{2}}^{*}+\ldots+a_{pj}{X_{p}}^{*},j=1,2,\ldots,m \tag{4}\]