3 — Methodology

Thesis · APA section

Thesis · Section 3 of 7 · Paper landing

3.1 Research design

Longitudinal ecological panel design; unit of analysis is the district-month (77 districts × 108 months, January 2015 – December 2023; N = 7,327 valid observations with non-missing, non-zero case data) (Bao et al., 2023; Hashizume et al., 2010). The analytical pipeline follows six sequential stages: (1) data acquisition and integration; (2) harmonization, quality assurance, and cleaning; (3) feature engineering; (4) exploratory analysis; (5) ML model development, training, and hyperparameter optimization; (6) model evaluation, feature-importance analysis, and result interpretation.

3.2 Study area

3.2.1 Geographic and administrative context

Nepal covers ~147,181 km² across 77 administrative districts spanning seven provinces. Districts range from ~241 km² (Bhaktapur) to ~3,422 km² (Dolpa), and from ~83,000 (Manang) to ~1,744,000 (Kathmandu) inhabitants (Central Bureau of Statistics, 2021).

3.2.2 Ecological zones and climatic characteristics

Three ecological zones span Nepal’s altitudinal gradient (60 m – 8,848 m asl):

  • Terai (60–300 m asl; ~17 % land, > 50 % population): humid subtropical; 25–30 °C; 1,400–2,500 mm annual precipitation.
  • Middle Hills (300–3,000 m asl; ~68 % land): temperate to subtropical; Kathmandu Valley ~18 °C, 1,400 mm.
  • High Mountain (> 3,000 m asl; ~15 % land): alpine to arctic; sparse populations.

The southwest monsoon (June–September) delivers ~75–80 % of annual precipitation.

3.2.3 Health infrastructure and WASH coverage

Three-tier system: district hospitals, primary health care centers, village-level health posts — all reporting through HMIS. Provincial WASH coverage ranges from 78 % (Bagmati) to 43 % (Karnali); improved sanitation access remains < 75 % in several Terai districts (Central Bureau of Statistics and UNICEF, 2019).

3.3 Data sources

Four primary institutional and open-access sources documented in detail in §6 Data:

Dataset Variable Resolution Provider Reference
HMIS Monthly outpatient typhoid case counts District-month MoHP / DoHS (Ministry of Health and Population, Government of Nepal, 2023)
DRR Portal Flood event counts District-month NDRRMA (NPDRR Nepal, 2025)
CHIRPS v2.0 Precipitation 0.05° (~5 km) Climate Hazards Group (Funk et al., 2015)
ERA5-Land 2 m air temperature, relative humidity 0.1° (~9 km) ECMWF · Copernicus (Muñoz-Sabater et al., 2021)
District shapefiles Administrative boundaries District polygons CBS (Central Bureau of Statistics, 2021) (Central Bureau of Statistics, 2021)

3.4 Data cleaning and integration

  1. Calendar conversion — Bikram Sambat → Gregorian via 12-month mapping table (max alignment error ~15 days per record).
  2. District-code reconciliation — CBS 3-digit codes as primary spatial merge key; 12 name-spelling variants resolved.
  3. Numeric cleaning — comma-formatted HMIS counts parsed (847 records corrected); extreme values audited.
  4. Spatial aggregation — CHIRPS and ERA5-Land grids aggregated to district polygons by area-weighted zonal statistics.
  5. Missing data — 2,463 district-months excluded; no outcome imputation. Final analytical sample: N = 7,327.

3.5 Feature engineering

Eleven features engineered into five functional categories:

Feature Category Derivation
log_cases Outcome transform log(cases + 1)
cases_lag1 Autoregressive cases value from prior calendar month, same district
precip_lag1 Lagged climate CHIRPS precipitation shifted 1 month
temp_mean_lag1 Lagged climate ERA5-Land temperature shifted 1 month
humidity_lag1 Lagged climate ERA5-Land humidity shifted 1 month
flood_lag1 Lagged climate DRR flood count shifted 1 month
precip_roll3 Cumulative climate rolling mean over t, t−1, t−2
temp_roll3 Cumulative climate rolling mean over t, t−1, t−2
monsoon Seasonal indicator 1 if month ∈ {Jun, Jul, Aug, Sep}
month_sin, month_cos Cyclical encoding sin/cos(2π × month / 12)

All lag and rolling features computed within each district to prevent cross-district leakage.

3.6 Train-test split and validation design

Strictly chronological split — last 12 calendar months (January 2022 – December 2023) reserved as held-out test set; preceding ~84 months for training. Within training, TimeSeriesSplit (k = 5) for XGBoost hyperparameter selection.

3.7 Machine-learning model specifications

3.7.1 Random Forest

scikit-learn 1.3 (Pedregosa et al., 2011); final hyperparameters from 5-fold CV grid search:

  • n_estimators = 500; max_depth = None; min_samples_split = 5; min_samples_leaf = 2; max_features = 'sqrt'; seed = 42.

3.7.2 XGBoost

xgboost 1.7 (Chen & Guestrin, 2016); Bayesian optimization with 50 evaluation trials:

  • n_estimators = 400; max_depth = 6; learning_rate = 0.05; subsample = 0.80; colsample_bytree = 0.80; min_child_weight = 3; reg_alpha = 0.10; reg_lambda = 1.00; gamma = 0.10; seed = 42.

3.7.3 Multilayer Perceptron

scikit-learn MLPRegressor (Pedregosa et al., 2011):

  • Hidden layers (128, 64, 32); activation ReLU; α = 0.001 L2 regularization.
  • Adam optimizer @ learning_rate_init = 0.001; max 500 epochs; early stopping triggered by validation-loss change < 1 × 10⁻⁴ for 20 consecutive iterations.
  • Features standardized using StandardScaler fitted only on training set.

3.7.4 Weighted Ensemble

Combines out-of-sample predictions of three base models using non-negative weights optimized to minimize RMSE on a held-out validation subset of training data, via scipy.optimize.minimize with SLSQP subject to weights ≥ 0 and Σweights = 1.

Optimized weights: XGBoost = 0.45, MLP = 0.35, RF = 0.20.

\[\hat{y}_{\text{ensemble}} = 0.20 \times \hat{y}_{\text{RF}} + 0.45 \times \hat{y}_{\text{XGB}} + 0.35 \times \hat{y}_{\text{MLP}}\]

3.8 Model evaluation metrics

  • RMSE = \(\sqrt{\sum (y_i - \hat{y}_i)^2 / n}\) — cases per district per month.
  • MAE = \(\sum |y_i - \hat{y}_i| / n\) — scale-interpretable.
  • R² = \(1 - SS_{\text{res}} / SS_{\text{tot}}\) — variance explained.
  • MAPE = \(100\% \times \sum |y_i - \hat{y}_i| / y_i / n\) — percentage error.

RMSE and MAE computed on back-transformed case-count predictions; R² computed on log-scale predictions.

3.9 Hyperparameter search summary

Model Hyperparameter Search space Optimized Method
RF n_estimators 100, 200, 300, 500 500 Grid
RF max_depth 5, 10, 20, None None Grid
XGB n_estimators 100–600 400 Bayesian
XGB max_depth 3–10 6 Bayesian
XGB learning_rate 0.01–0.30 0.05 Bayesian
XGB reg_alpha (L1) 0.00–1.00 0.10 Bayesian
XGB reg_lambda (L2) 0.50–2.00 1.00 Bayesian
MLP hidden_layer_sizes multiple configs (128, 64, 32) Manual
MLP alpha (L2) 0.0001–0.01 0.001 Grid
Ensemble RF / XGB / MLP weights 0–1, Σ=1 0.20 / 0.45 / 0.35 SLSQP

3.10 Ethical considerations and data limitations

The study used only aggregate, de-identified, district-level surveillance and climate data; no individual patient records were accessed. All HMIS data obtained through official institutional channels with appropriate data-access authorization. Five categories of limitation acknowledged:

  • HMIS under-reporting likely most severe in Karnali and Sudurpashchim.
  • Diagnostic misclassification without lab confirmation (Parry et al., 2002).
  • Spatial aggregation averages over intra-district heterogeneity.
  • Flood-event underregistration for small-scale events.
  • Ecological fallacy — findings describe population-level associations.

← Back: 2 — Literature Review · → Next: 4 — Results

References

Bao, Y., Liu, J., Zhang, M., Zhou, X., & Shi, Y. (2023). Predicting typhoid fever incidence using machine learning models: A study in Jiangsu Province, China. BMC Infectious Diseases, 23(1), Article 525. https://doi.org/10.1186/s12879-023-08411-7
Central Bureau of Statistics. (2021). National population and housing census 2021: Preliminary results. Government of Nepal. https://cbs.gov.np
Central Bureau of Statistics and UNICEF. (2019). Nepal multiple indicator cluster survey 2019: Survey findings report. Central Bureau of Statistics; UNICEF.
Chen, T., & Guestrin, C. (2016). XGBoost: A scalable tree boosting system. Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 785–794. https://doi.org/10.1145/2939672.2939785
Funk, C., Peterson, P., Landsfeld, M., Pedreros, D., Verdin, J., Shukla, S., Husak, G., Rowland, J., Harrison, L., Hoell, A., & Michaelsen, J. (2015). The climate hazards infrared precipitation with stations—a new environmental record for monitoring extremes. Scientific Data, 2, 150066. https://doi.org/10.1038/sdata.2015.66
Hashizume, M., Faruque, A. S. G., Wagatsuma, Y., Hayashi, T., & Armstrong, B. (2010). Cholera in Bangladesh: Climatic components of seasonal variation. Epidemiology, 21(5), 706–710. https://doi.org/10.1097/EDE.0b013e3181e5b053
Ministry of Health and Population, Government of Nepal. (2023). Annual report of the department of health services 2022/23. Government of Nepal.
Muñoz-Sabater, J., Dutra, E., Agustí-Panareda, A., Albergel, C., Arduini, G., Balsamo, G., & Thépaut, J.-N. (2021). ERA5-Land: A state-of-the-art global reanalysis dataset for land applications. Earth System Science Data, 13(9), 4349–4383. https://doi.org/10.5194/essd-13-4349-2021
NPDRR Nepal. (2025). Nepal disaster statistics 2012–2024. https://www.drrportal.gov.np/
Parry, C. M., Hien, T. T., Dougan, G., White, N. J., & Farrar, J. J. (2002). Typhoid fever. New England Journal of Medicine, 347(22), 1770–1782. https://doi.org/10.1056/NEJMra020201
Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., Blondel, M., Prettenhofer, P., Weiss, R., Dubourg, V., Vanderplas, J., Passos, A., Cournapeau, D., Brucher, M., Perrot, M., & Duchesnay, E. (2011). Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12, 2825–2830.