PM2.5 Temporal Pattern Analysis and Prediction in a Tropical Urban Area Using Community-Based IoT Sensor Network and Machine Learning
Abstract
Air quality monitoring in rapidly growing tropical cities remains a critical challenge. This study presents a combined temporal analysis and machine learning-based prediction of PM2.5 concentrations in a tropical urban area, Indonesia, using hourly data from three community-operated PurpleAir IoT sensor nodes throughout 2025 (9,117 observations). Temporal analysis revealed mean PM2.5 concentrations of 33.7–36.6 μg/m3, consistently exceeding the WHO annual guideline of 15 μg/m3. Diurnal profiles showed afternoon-to-evening peaks (11:00–18:00 WIB) and early-morning troughs (07:00–08:00 WIB), while wet-season PM2.5 levels were 35–39% lower than dry-season levels. Three machine learning models—Linear Regression (LR), Random Forest (RF), and Gradient Boosting (GB)—were trained on 16 engineered features comprising autoregressive lag variables, rolling statistics, meteorological parameters, and temporal calendar features. Using a time-based 80:20 train-test split, the best models achieved R2 values of 0.79 (Node 1, LR), 0.78 (Node 2, GB), and 0.77 (Node 3, RF), with RMSE in the range of 8.3–10.4 μg/m3. Feature importance analysis identified PM2.5 lag-1h as the dominant predictor (76.1%), followed by meteorological variables and temporal features. A preliminary cross-node time-lag correlation analysis showed that even co-located sensors (~20 m apart) exhibited only moderate agreement (r ≈0.43), indicating that indoor/outdoor placement influences spatial consistency as much as physical distance. Robustness was further assessed via 5-fold blocked time-series cross-validation, which showed lower and more variable performance than the single-split estimates, and via comparison with a univariate LSTM baseline, which underperformed (R2=0.524) relative to the classical models at the available data volume. Multi-step forecasting experiments showed accuracy degrading sharply beyond a 1-hour horizon. These findings demonstrate the feasibility of deploying lightweight machine learning pipelines on community IoT sensor data for near-real-time air quality forecasting in smart city contexts, while highlighting current limitations in longer-horizon prediction and deep learning applicability at this data scale.