Short-term forecasting of indoor CO2 concentration in commercial pig barns using time-series models: A walk-forward validation and out-of-sample testing framework
Received: Jul 27, 2026; Revised: Sep 21, 2026; Accepted: Nov 03, 2026
Published Online: Nov 13, 2026
Abstract
Short-term forecasting of CO2 concentration in commercial pig barns (CPBs) is essential for effective indoor air quality management. However, previous studies have often used simple train–test splitting for CO2 forecasting, which may not adequately capture real-world temporal variability in CPBs. Therefore, this study integrated walk-forward (WF) validation with continuous model updating and out-of-sample (OOS) testing to assess forecasting performance on unseen observations. Hourly-resampled data were used to generate one-step-ahead forecasts for the subsequent hour. Four time-series models, ARIMA, SARIMA, SARIMAX, and Prophet, were evaluated using indoor environmental data from Barn A (piglets) and Barn B (sows), while Barn C (control) was included for comparison of indoor environmental conditions across the three barn types. Model performance was assessed using root mean squared error (RMSE), mean absolute error (MAE), mean absolute percentage error (MAPE), residual diagnostics, and the entropy-weighted residual quality index (EW-RQI). Significant differences in indoor air quality parameters were observed among the barns (p < 0.001). During WF validation, SARIMAX achieved the best overall forecasting performance in Barn A, reducing RMSE, MAE, and MAPE by 4.58–55.37%, 3.50–61.73%, and 2.54–63.83%, respectively, compared with the other models, whereas performance differences in Barn B were relatively small. During OOS testing, SARIMAX remained the best-performing model in Barn B, reducing RMSE, MAE, and MAPE by 15.67–42.04%, 7.10–41.31%, and 6.67–40.71%, respectively. In Barn A, SARIMAX achieved lower MAE and MAPE, although ARIMA produced the lowest RMSE. Moreover, SARIMA and SARIMAX exhibited the better overall residual quality, achieving the highest EW-RQI values across both WF validation and OOS testing. These findings may provide valuable insights for monitoring CO2 concentrations and support improved indoor atmospheric management in CPBs.