# Clustering-Based Segmented Regression for Particulate Matter Sensor Calibration
## 2 Materials and Methods
### Methodology Design
#### 2.3.3 Calibration Model  
For PM sensor in-field calibration, our proposed method is clustering-based segmented regression. Sensory data of PM concentration, temperature and relative humidity are used to compensate measurement deviation and hourly PM concentration data from a standard monitoring station nearby are used as calibration reference. The method consists of two stages, modeling and calibrating.  
**Modeling.** Sensory data concerning PM concentration, temperature, and relative humidity are firstly averaged hourly so that they have same interval with PM concentration data from standard monitoring station. Then, normalization of sensory data according to the sensor's range is required for their range difference. We can combine PM concentration, temperature and relative humidity into tuple \(X\),  
\[X(n)=(P(n),T(n),H(n)) \tag{1}\]  
where \(P\) represents PM concentration, \(T\) represents temperature, \(H\) represents relative humidity and \(n\) is time. Each tuple \(X(n)\) has an hourly station PM concentration reference \(Y(n)\) corresponding at time \(n\). As shown in Figure 5, with clustering algorithm all samples  
Figure 4: Samples: Sensory temperature vs. error to be calibrated (PM\({}_{2.5}\))  
Figure 3: Samples: Sensory relative humidity vs. error to be calibrated (PM\({}_{2.5}\))of \(X(n)\) are divided into several clusters. For each cluster, a corresponding multiple linear regression model can be calculated with \((X(n),Y(n))\) in the cluster,  
\[R_{k}(n)=a_{1,k}P(n)+a_{2,k}T(n)+a_{3,k}H(n)+a_{4,k} \tag{2}\]  
where \(\{a_{1,k},a_{2,k},a_{3,k},a_{4,k}\}\) are parameters calculated by least square fitting and \(R_{k}(n)\) represent calibrated value of sample \(X(n)\) in cluster \(k\) at time \(n\).  
**Calibrating.** Steps of the calibration stage are shown in Figure 6. With the clusters and their corresponding multiple linear regression models obtained in the modeling step, sensory data of PM concentration can be calibrated. When new samples of sensory data arrive, normalization and combining them into tuple \(X(t)\) as Equation (1) are preparation steps. Based on the shortest distance under some metric (e.g., Euclidean Distance), tuple \(X(t)\) can be used to find the cluster it belongs to. If tuple \(X(t)\) belongs to the cluster \(k\), according to Equation (2), \(R_{t,k}\) is the calibrated sensory PM concentration at time \(t\) and it can be calculated as below:  
\[R_{t,k}=a_{1,k}P(t)+a_{2,k}T(t)+a_{3,k}H(t)+a_{4,k} \tag{3}\]  
In practice due to seasonality, the modeling can describe the relationship between deviation and factors (PM concentration, temperature and relative humidity) approximately based on short-term sampled data. Thus, in long-term sensing system deployment, this method needs to be executed periodically and cluster division and corresponding multiple linear regression models require regular updating, in order to catch up with the calibration performance.  
Figure 5: Modeling stage : Clustering-based segmented regression  
Figure 6: Calibrating stage : Clustering-based segmented regression