# Hierarchical Modelling for CO\({}_{2}\) Variation Prediction for HVAC System Operation
## 3 Data Preliminaries
### Exploratory Data Analysis  
The exploratory data analysis is fundamental to estimating the prediction and history time windows predicated on the studied space. These time frames best reflect the existing relationship between the CO\({}_{2}\) concentration levels, and the lagged versions of activity levels, humidity, pressure, temperature, and CO\({}_{2}\) levels. This analysis is important to validate the existence and the extent of time correlations between IAQ features; a characteristic that rationalises any modelling-related decision. Many methods can be applied to quantify the relationship between lagged versions of IAQ features and the CO\({}_{2}\) concentration. The original work's feature engineering step extracted lagged versions of features to predict future CO\({}_{2}\) using ML techniques such as RR. Good results with a low Mean Absolute Error (MAE) were obtained using RR, which assumes a linear relationship between the features and the response variable. Therefore, a linear function can successfully quantify the relationship between lagged versions of the environment features and the CO\({}_{2}\) concentrations. These assumptions align with the guiding principles of the Pearson Correlation Coefficient (PCC), which measures the strength of the linear relationship between two continuous variables. The environmental features and their lagged versions are denoted by \(X_{i}\) and the CO\({}_{2}\) level by \(C\). Given an environmental feature \(X_{i}\) and \(C\), the PCC represented by \(\rho\) is as follows:  
\[\rho_{X_{i}C}=\frac{\mathbf{E}[(X_{i}-\mu_{X_{i}})(C-\mu_{C})]}{\sigma_{X_{i}} \sigma_{C}} \tag{1}\]  
such that:  
* \(\mathbf{E}\) is the expectation
* \(\mu_{X_{i}}\) is the mean of \(X_{i}\)
* \(\mu_{C}\) is the mean of \(C\)
* \(\sigma_{X_{i}}\) is the standard deviation of \(X_{i}\)
* \(\sigma_{C}\) is the standard deviation of \(C\)  
The analysis that follows is conducted on a single room denoted by room00, which fits 12 people. The lag time distribution with respect to each dataset when the correlation between CO\({}_{2}\) and other features is below a certain threshold is displayed in Figure 1. This calculation allows inferring the time window whereby a lagged feature can explain the changes in CO\({}_{2}\) concentrations. The correlation thresholds involved are \(\{0.2\longrightarrow 1\}\) with a 0.1 increment. If the threshold is not found, meaning the dataset has a higher correlation than the threshold, a value of \(-10\) is returned to emphasize the distinction in the distribution figure. Figure 1 shows the lag time distribution with respect to each parameter using correlation thresholds. The displayed thresholds are determined based on a comprehensive evaluation of the obtained correlations for each feature. Both activity levels and CO\({}_{2}\) displayed high correlation values of above 0.5 in the majority of the datasets. These results justify the results in [30], whereby the lowest MAE is the result of combining these two features. This observation can be inferred by small peaks for both parameters for lag time 0. Moreover, the figure shows that in the majority of the datasets, a high positive correlation exists (\(\geq\)0.5) at a lag time above 20 min, which also includes the lag time of \(-\)10. On the other hand, the distribution results demonstrate a weaker positive relationship (\(\leq\)0.2) with the CO\({}_{2}\) concentrations. The datasets with no occupancy changes have contributed to the dilution of the results with no or low correlation results. These correlation results do not prove that there is no complementarity between the environmental features, rather it determines the reasonable prediction time windows. Therefore, in the applied methodology, all the parameters were used with a variable lag time of 5, 10, 15, and 20 min. These lag times incorporate all the levels of the existing correlations between environmental features. The choice of prediction horizons is also connected to HVAC systems.