Scinovex
article Open Access

Exploring deviance residual analysis for generalized linear models with applications to west african sahel grain storage

Abstract

How well does a generalized linear model actually fit? Deviance residuals offer one of the most informative answers to that question, yet their distributional behaviour under model misspecification remains incompletely characterised, particularly for count data with overdispersion. This research examines deviance residuals across Poisson, negative binomial, and quasi-Poisson generalized linear models (GLMs) and applies the diagnostic framework to grain storage loss data from the West African Sahel. Tail distribution properties of deviance residuals were derived under both correctly specified and misspecified link functions, establishing bounds on the probability of extreme residuals that depend on the tail dependence structure of the response. Fiber bundle representations of the parameter space provided geometric insight into how curvature of the likelihood surface affects residual calibration. Field data on post-harvest grain loss were collected from 184 farming households across Burkina Faso and Niger during the 2019-2022 storage seasons. Storage methods included hermetic bags, traditional raised granaries, metal silos, and plastic drums. Loss proportions were modelled as functions of storage method, grain type, humidity, and storage duration. The negative binomial GLM yielded the best-calibrated deviance residuals, with a Kolmogorov-Smirnov statistic of 0.038 against the standard normal distribution. Traditional granaries showed the highest mean loss at 14.7 percent, while hermetic bags reduced loss to 5.1 percent. Number-theoretic properties of the deviance statistic under prime-order finite field restrictions were noted as a byproduct of the probability distribution analysis. The results support the routine use of deviance residual diagnostics in applied GLM work and provide actionable evidence for grain storage policy in the Sahel region.

Full Text

Tables and figures are in the full-text PDF.

Introduction

What does a residual of 3.4 really mean? In ordinary linear regression the answer is relatively clear it is 3.4 standard deviations from the fitted value, and under normality such a value is unusual. In generalized linear models the situation is murkier. Raw residuals are heteroscedastic by construction, Pearson residuals correct for variance but not for skewness, and deviance residuals attempt a deeper fix by projecting each observation onto the likelihood surface [1] . Practitioners often treat deviance residuals as though they follow a standard normal distribution, but this approximation can fail badly when the model is wrong or when the data sit in the tails. Grain storage in the Sahel offers a setting where getting the model right matters. Post-harvest losses in sub-Saharan Africa reach 20 to 30 percent of cereal production by some estimates, and much of this loss occurs during storage where insects, moulds, and rodents degrade stored grain over months [2] . Identifying which storage methods reduce loss and by how much requires count or proportion models that handle overdispersion, zero-inflation, and nonconstant variance. GLMs are the natural modelling family, but if residual diagnostics are unreliable the analyst may accept a poorly fitting model and draw flawed conclusions about storage technology effectiveness. This research derives residuals under correctly specified and misspecified GLMs, using fiber bundle geometry to visualise the parameter space and its curvature effects on residual behaviour [3] . On the applied side, it analyses grain loss data from 184 households in Burkina Faso and Niger, comparing Poisson, negative binomial, and quasi-Poisson specifications. The aim was both to sharpen the theoretical understanding of deviance residual calibration and to provide reliable evidence on which storage technologies best protect Sahel grain harvests [4] .

Study area description

Data were collected in two agro-ecological zones within the West African Sahel. The Burkina Faso sites (108 households) were located in the provinces of Yatenga and Loroum in the Nord region (13.5-14.0 degrees N, 2.0-2.5 degrees W), an area receiving 450 to 600 mm of annual rainfall concentrated between June and September. Soils are predominantly sandy laterite with limited organic matter. The Niger sites (76 households) were in the Maradi and Tahoua regions (13.0-14.5 degrees N, 5.0-7.0 degrees E), where annual rainfall is slightly lower at 350 to 500 mm. and sorghum are the dominant stored cereals in both areas, with cowpea as a secondary crop. Storage periods typically run from October harvest through the following May or June, exposing grain to the hot dry harmattan season followed by the onset of humid conditions before the next rains [5] .

Materials and methods

Materials

Household-level grain storage data were gathered through structured surveys administered at the end of each storage season from 2019 to 2022. Enumerators recorded the storage method, grain type, initial quantity stored, quantity remaining at the end of the storage period, storage duration in months, and mean ambient humidity measured with portable hygrometers. Four storage categories were distinguished: hermetic (PICS) bags, traditional raised mud-brick granaries, metal silos, and plastic drums. Loss was calculated as the percentage of initial quantity missing at the end of storage, excluding intentional withdrawals documented in household logbooks. All statistical analyses were performed at the Cartagena Academy of Statistical Research, Cartagena, Colombia, between September 2022 and March 2023. Ethical approval was obtained from the Cartagena Academy Research Ethics Board (Protocol CA-2022-017, approved June 2022) for the secondary analysis of anonymized survey data [6] .

Methods

Three GLM specifications were fitted to the loss count data (number of kilograms lost per 100 kg stored): a Poisson GLM with log link, a negative binomial GLM with log link, and a quasi-Poisson GLM. Covariates included storage method, grain type, storage duration, and mean humidity. Deviance residuals were computed for each specification and their empirical distribution compared against the standard normal using Kolmogorov-Smirnov (K-S) and Anderson-Darling tests. Tail probability bounds were derived by expressing the deviance as a function on a fiber bundle whose base space is the covariate space and whose fiber is the natural parameter of the exponential family [3] . The tail dependence coefficient between adjacent observations (households in the same village) was estimated using bivariate extreme value methods. Model comparison used AIC, BIC, and the dispersion parameter [7] .

Sensitivity analysis

Sensitivity of deviance residual calibration to sample size was assessed by bootstrap subsampling at 50, 75, and 100 percent of the full dataset (1000 resamples each). The K-S statistic for the negative binomial model remained below 0.05 at all subsample fractions, while the Poisson model exceeded 0.10 even at full sample size. Sensitivity to the humidity covariate threshold was tested by discretising humidity into two, three, and four categories; results were stable across categorizations, with the negative binomial AIC changing by less than 2.4 units. Excluding the 12 households with storage durations below three months shifted the mean loss estimate by less than 0.3 percentage points [8] . The negative binomial GLM produced the lowest AIC and BIC, and its dispersion parameter of 1.08 indicated nearperfect variance calibration. The K-S test for its deviance residuals returned a p-value of 0.714, showing no evidence of departure from normality. The Poisson model was strongly overdispersed (dispersion 4.72) and its residuals deviated significantly from the normal reference. Traditional granaries showed the widest spread and highest median loss. Hermetic bags produced the lowest median and tightest distribution, with only two outliers exceeding 10 percent loss. Metal silos performed well but showed more variability than hermetic bags, possibly reflecting differences in seal quality across installations.

Results

Discussion

The clear superiority of the negative binomial GLM in this dataset confirms what many applied statisticians suspect: Poisson models for count data from agricultural surveys almost always understate variability [9] . The dispersion parameter of 4.72 under the Poisson specification is not unusual for household-level loss data, where unobserved heterogeneity in storage conditions, insect pressure, and grain quality inflates variance well beyond the Poisson meanequals-variance assumption. The quasi-Poisson approach partially addresses this by scaling the variance, but because it does not alter the likelihood itself, the deviance residuals remain mis-calibrated. From a theoretical perspective, the fiber bundle representation of the exponential family parameter space clarifies why deviance residuals behave differently under correct and incorrect specifications. When the model is correct, the fiber over each covariate value is a one-dimensional manifold along which the deviance function is approximately quadratic. Misspecification warps the fiber, introducing curvature that distorts the chi-squared approximation underlying the deviance statistic [3] . The tail bounds derived here quantify this distortion and could be used as diagnostic thresholds in practice.

On the applied side, the finding that hermetic bags reduce grain loss to roughly 5 percent aligns with field trials conducted across West Africa [10] . The 14.7 percent loss in traditional granaries, while substantial, is lower than some earlier estimates for the Sahel, possibly because the surveyed households had relatively short storage durations averaging 6.3 months. Metal silos performed well but their higher upfront cost remains a barrier to adoption among smallholder farmers [11] .

Conclusion

This research demonstrated that deviance residual calibration varies markedly across GLM specifications for overdispersed count data, with the negative binomial model achieving nearnormal residuals (K-S p = 0.714) while the Poisson model failed decisively. The fiber bundle framework provides a geometric explanation for this discrepancy and yields practical tail bounds for diagnostic use. In the grain storage application, hermetic bags reduced post-harvest loss to 5.1 percent on average, less than half the loss observed in traditional granaries. These results argue for the routine use of deviance residual checks alongside standard information criteria when selecting GLMs for agricultural count data. Future work should extend the tail bounds to zero-inflated and hurdle models, which may better capture the fraction of households that experience no storage loss at all. For Sahel grain storage policy, the evidence strongly favours expanding access to hermetic bag technology, with metal silos as a durable alternative where supply chains permit.

Acknowledgement

Acknowledgements Funding sourcesThis research was supported by internal departmental funds without external grant backing.

References

  1. McCullagh P, Nelder JA. Generalized linear models. 2nd ed. London: Chapman and Hall; 1989.
  2. Affognon H, Mutungi C, Sanginga P, Borgemeister C. Unpacking postharvest losses in sub-Saharan Africa: a meta-analysis. World Dev. 2015; 66:49-68.
  3. McCullagh P. Tensor methods in statistics. London: Chapman and Hall; 1987.
  4. Hilbe JM. Negative binomial regression. 2nd ed. Cambridge: Cambridge University Press; 2011.
  5. Guindo D, Davrieux F, Teme N, et al. Grain quality of Malian Sorghum bicolor landraces. J Cereal Sci. 2016; 69:51-56.
  6. Baoua IB, Amadou L, Ousmane B, et al. PICS bags for post-harvest storage of maize grain in West Africa. J Stored Prod Res. 2014; 58:20-28.
  7. Cameron AC, Trivedi PK. Regression analysis of count data. 2nd ed. Cambridge: Cambridge University Press; 2013.
  8. Venables WN, Ripley BD. Modern applied statistics with S. 4th ed. New York: Springer; 2002.
  9. Ver Hoef JM, Boveng PL. Quasi-Poisson vs. negative binomial regression: how should we model overdispersed count data? Ecology. 2007;88(11):2766-2772.
  10. Murdock LL, Margam V, Baoua IB, et al. Death by desiccation: effects of hermetic storage on cowpea bruchids. J Stored Prod Res. 2012; 49:166-170.
  11. Tefera T, Kanampiu F, De Groote H, et al. The metal silo: an effective grain storage technology for reducing post-harvest insect and pathogen losses in maize while improving smallholder farmer's food security in developing countries. Crop Prot. 2011;30(3):240-245.
  12. Agresti A. Foundations of linear and generalized linear models. Hoboken (NJ): John Wiley & Sons; 2015.
  13. Dunn PK, Smyth GK. Randomized quantile residuals. J Comput Graph Stat. 1996;5(3):236-244.
  14. Pierce DA, Schafer DW. Residuals in generalized linear models. J Am Stat Assoc. 1986;81(396):977-986.
  15. Davison AC, Gigli A. Deviance residuals and normal scores plots. Biometrika. 1989;76(2):211-221.
Statistical Methods and Bayesian InferenceAdvanced Statistical Methods and ModelsStatistical Distribution Estimation and Applicationsdeviance residualscount datamodel misspecificationgeneralized linear modelsWest African Saheloverdispersiontail dependence
Citations
0
FWCI
0.00
field-weighted impact
References
0
Percentile
60%
vs. same field & year
Citation Network

How this paper connects to the literature. Drag to explore, click any node to open that paper.