The study aimed to evaluate the performance of Generalized Additive Mixed Models (GAMMs) in fitting and predicting cattle milk production variables in Tanzania. The study used the National Panel Survey data collected between 2012 and 2021. GAMM (gamma), GAMM (lognormal), and GAMM (inverse normal) were fitted, and their performance was evaluated using Akaike Information Criterion (AIC), proportional of deviance explained, Root Mean Squared Error (RMSE), and Mean Absolute Error (MAE). The findings show that the GAMM with the lognormal distribution performed best, having a balanced good fit and predictive performance (AIC=4714.36, deviance explained = 94%, RMSE = 4.72, and MAE=2.94). Although the GAMM with the gamma distribution had a slightly better prediction accuracy (RMSE = 4.27 and MAE =2.77), it had a higher AIC (5027.75) and a smaller proportion of deviance explained (59%), making it less suitable for identifying factors affecting cattle milk production. The GAMM with the inverse normal distribution showed the poorest performance, with the highest AIC (5366.34), lowest deviance explained (37.3%), and largest errors (RMSE = 13.64, MAE = 4.46). Despite the poor performance of the GAMM with the inverse normal distribution, the overall results demonstrate that GAMMs are an effective tool for fitting and predicting cattle milk production variables, particularly when data are collected repeatedly from the same units over time. The GAMM with the lognormal distribution not only provided accurate predictions but also offered valuable insights into nonlinear relationships between milk production and household inputs. These insights can guide dairy farmers and policymakers in optimizing milk production by focusing on key factors such as improved breeding practices, proper feeding, health management, and labour efficiency.
Published in | Mathematical Modelling and Applications (Volume 10, Issue 2) |
DOI | 10.11648/j.mma.20251002.12 |
Page(s) | 31-42 |
Creative Commons |
This is an Open Access article, distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution and reproduction in any medium or format, provided the original work is properly cited. |
Copyright |
Copyright © The Author(s), 2025. Published by Science Publishing Group |
Generalized Additive Mixed Models, Household Input, Cattle Milk Production
[1] | The United Republic of Tanzania, “LIVESTOCK SECTOR TRANSFORMATION PLAN (LSTP) 2022/23 - 2026/27.” Accessed: Nov. 28, 2022. Available: https://www.mifugouvuvi.go.tz/uploads/publications/sw1675840376-LIVESTOCK SECTOR TRANSFORMATION PLAN (LSTP) 202223 - 202627.pdf |
[2] | United Republic of Tanzania- Ministry of Livestock and Fisheries, “Tanzania Livestock Sector Analysis) 2016/2017-3031/2032),” =, p. 150, 2017,. Available: |
[3] | B. K. Paul et al., “Reducing agro-environmental trade-offs through sustainable livestock intensification across smallholder systems in Northern Tanzania,” Int. J. Agric. Sustain., vol. 18, no. 1, pp. 35–54, 2020, |
[4] | Q. T. Nguyen, R. Fouchereau, E. Frénod, C. Gerard, and V. Sincholle, “Comparison of forecast models of production of dairy cows combining animal and diet parameters,” Comput. Electron. Agric., vol. 170, 2020, |
[5] | L. Sanzogni and D. Kerr, “Milk production estimates using feed forward artificial neural networks,” 2001. |
[6] | O. B. Kashongwe, B. O. Bebe, J. W. Matofari, and C. G. Huelsebusch, “Effects of feeding practices on milk yield and composition in peri-urban and rural smallholder dairy cow and pastoral camel herds in Kenya,” Trop. Anim. Health Prod., vol. 49, no. 5, pp. 909–914, 2017, |
[7] | S. M. Feroze, R. Singh, and S. Sirohi, “Economics of milk production and factors affecting milk yield in Meghalaya: Estimating the seasonal effect,” Indian J. Dairy Sci., vol. 72, no. 3, pp. 328–335, 2019, |
[8] | W. Little, B. F. Sansom, R. Manston, and W. M. Allen, “Effects of restricting the water intake of dairy cows upon their milk yield, body weight and blood composition,” Cambridge Univ. Pres, vol. 22, no. 3, pp. 329–339, 2010, |
[9] | S. Popescu, C. Borda, E. A. Diugan, M. Niculae, R. Stefan, and C. D. Sandru, “The effect of the housing system on the welfare quality of dairy cow,” Ital. J. Anim. Sci., vol. 13, no. 1, pp. 15–22, 2014, |
[10] | S. Walsh, F. Buckley, K. Pierce, N. Byrne, J. Patton, and P. Dillon, “Effects of breed and feeding system on milk production, body weight, body condition score, reproductive performance, and postpartum ovarian function,” J. Dairy Sci., vol. 91, no. 11, pp. 4401–4413, 2008, |
[11] | W. Kabaka, G. Gitau, P. Kitala, N. Maingi, and J. Van Leeuwen, “The prevalence of gastrointestinal nematode infection and their impact on cattle in Nakuru and Mukurweini districts of Kenya,” Ethiop. Vet. J., vol. 17, no. 1, p. 95, 2014, |
[12] | O. Lipps, “Panel Surveys: advantages and disadvantages compared with repeated cross-sectional surveys. FORS Guide No. 14, Version 1.0. Lausanne (FORS).,” no. 14, pp. 1–13, 2021, |
[13] |
T. K. Maity and A. K. Pal, “Subject specific treatment to neural networks for repeated measures analysis,” Lecture Notes in Engineering and Computer Science. Accessed: Jun. 12, 2023. Available:
https://www.iaeng.org/publication/IMECS2013/IMECS2013_pp60-65.pdf |
[14] | R. S. Gandhi, T. V. Raja, A. P. Ruhil, and A. Kumar, “Artificial neural network versus multiple regression analysis for prediction of lifetime milk production in sahiwal cattle,” Journal of Applied Animal Research, vol. 38, no. 2. pp. 233–237, 2010. |
[15] | O. Gorgulu, “Prediction of 305-day milk yield in Brown Swiss cattle using artificial neural networks,” S. Afr. J. Anim. Sci., vol. 42, no. 3, 2012, |
[16] | W. Grzesiak, R. Lacroix, J. Wójcik, and P. Błaszczyk, “A comparison of neural network and multiple regression predictions for 305-day lactation yield using partial lactation records,” Can. J. Anim. Sci., vol. 83, no. 2, pp. 307–310, 2003, |
[17] | M. D. Murphy, M. J. O’Mahony, L. Shalloo, P. French, and J. Upton, “Comparison of modelling techniques for milk-production forecasting,” J. Dairy Sci., vol. 97, no. 6, pp. 3352–3363, 2014, |
[18] | V. Hassija et al., “Interpreting Black-Box Models: A Review on Explainable Artificial Intelligence,” Cognit. Comput., vol. 16, no. 1, pp. 45–74, 2024, |
[19] | E. J. Pedersen, D. L. Miller, G. L. Simpson, and N. Ross, “Hierarchical generalized additive models in ecology: An introduction with mgcv,” PeerJ, vol. 2019, no. 5, 2019, |
[20] |
V. Mamouridis, “Additive Mixed Models applied to the study of red shrimp landings : comparison between frequentist and Bayesian perspectives. University of Coruna.” Accessed: Mar. 10, 2021. Available:
http://eio.usc.es/pub/mte/descargas/ProyectosFinMaster/Proyecto_393.pdf |
[21] |
The United Republic of Tanzania, “Tanzania National Panel Survey (NPS) Waves 3, 4, and 5 (2012-2021). National Bureau of Statistics.” Accessed: Oct. 02, 2022. Available:
https://microdata.worldbank.org/index.php/auth/login/?destination=catalog/2252/get-microdata |
[22] |
J. Hair, R. Anderson, B. Babin, and W. Black, “Multivariate Data Analysis.” Accessed: Feb. 27, 2020. Available:
https://www.drnishikantjha.com/papersCollection/Multivariate Data Analysis.pdf |
[23] | M. W. Watkins, “Exploratory Factor Analysis: A Guide to Best Practice,” J. Black Psychol., vol. 44, no. 3, pp. 219–246, 2018, |
[24] | N. Shrestha, “Detecting Multicollinearity in Regression Analysis,” Am. J. Appl. Math. Stat., vol. 8, no. 2, pp. 39–42, 2020, |
[25] | M. G. Pizarro, V. Landi, F. J. Navas González, J. M. León, and J. V. Delgado, “Non-parametric analysis of the effects of αS1-casein genotype and parturition non-genetic factors on milk yield and composition in Murciano-Granadina goats,” Ital. J. Anim. Sci., vol. 18, no. 1, pp. 1021–1034, 2019, |
[26] | G. Shmueli, “To explain or to predict?,” Stat. Sci., vol. 25, no. 3, pp. 289–310, 2010, |
[27] | Z. Bonza, R. Katapa, and A. Msengwa, “Bayesian predictive modelling to ascertain factors affecting cattle milk production in Tanzania: Evidence from the national panel surveys 2012 – 2021,” Vet. Anim. Sci., vol. 27, 2024, |
[28] | J. H. Carag, C. K. Lesorogol, and L. L. Iannotti, “Global nutrition security: The role of Veterinary Services,” OIE Rev. Sci. Tech., vol. 40, no. 2, pp. 523–532, 2021, |
[29] | I. Kashoma and A. Ngou, “Insight into the adoption and success of artificial insemination services in smallholder dairy farming systems: A cross-sectional study.,” Tanzania Veterinary Journal. Accessed: Nov. 30, 2024. Available: |
[30] | Y. P. Nagagi, E. G. Kimaro, and V. Temba, “Practical application and the possible emergence of tick resistance to commonly usedacaricides in various districts of Tanzania,” Livestock Research for Rural Development. Accessed: Oct. 09, 2024. Available: |
[31] | J. S. Chang’a, R. H. Mdegela, R. Ryoba, T. Løken, and O. Reksen, “Calf health and management in smallholder dairy farms in Tanzania,” Tropical Animal Health and Production, vol. 42, no. 8. pp. 1669–1676, 2010. |
[32] | M. Catangui, “Dewormers for beef and diary cattle.” Accessed: Dec. 19, 2024. Available: |
[33] | T. Smith, “Proper Timing And Proper Products Needed For Deworming Pasture Cattle.” Accessed: Dec. 19, 2024. Available: |
APA Style
Bonza, Z., Katapa, R., Msengwa, A. (2025). Assessing the Efficiency of Generalized Additive Mixed Models (GAMMs) Using Milk Production Variables: Evidence from Tanzania’s National Panel Surveys. Mathematical Modelling and Applications, 10(2), 31-42. https://doi.org/10.11648/j.mma.20251002.12
ACS Style
Bonza, Z.; Katapa, R.; Msengwa, A. Assessing the Efficiency of Generalized Additive Mixed Models (GAMMs) Using Milk Production Variables: Evidence from Tanzania’s National Panel Surveys. Math. Model. Appl. 2025, 10(2), 31-42. doi: 10.11648/j.mma.20251002.12
@article{10.11648/j.mma.20251002.12, author = {Zainabu Bonza and Rosalia Katapa and Amina Msengwa}, title = {Assessing the Efficiency of Generalized Additive Mixed Models (GAMMs) Using Milk Production Variables: Evidence from Tanzania’s National Panel Surveys }, journal = {Mathematical Modelling and Applications}, volume = {10}, number = {2}, pages = {31-42}, doi = {10.11648/j.mma.20251002.12}, url = {https://doi.org/10.11648/j.mma.20251002.12}, eprint = {https://article.sciencepublishinggroup.com/pdf/10.11648.j.mma.20251002.12}, abstract = {The study aimed to evaluate the performance of Generalized Additive Mixed Models (GAMMs) in fitting and predicting cattle milk production variables in Tanzania. The study used the National Panel Survey data collected between 2012 and 2021. GAMM (gamma), GAMM (lognormal), and GAMM (inverse normal) were fitted, and their performance was evaluated using Akaike Information Criterion (AIC), proportional of deviance explained, Root Mean Squared Error (RMSE), and Mean Absolute Error (MAE). The findings show that the GAMM with the lognormal distribution performed best, having a balanced good fit and predictive performance (AIC=4714.36, deviance explained = 94%, RMSE = 4.72, and MAE=2.94). Although the GAMM with the gamma distribution had a slightly better prediction accuracy (RMSE = 4.27 and MAE =2.77), it had a higher AIC (5027.75) and a smaller proportion of deviance explained (59%), making it less suitable for identifying factors affecting cattle milk production. The GAMM with the inverse normal distribution showed the poorest performance, with the highest AIC (5366.34), lowest deviance explained (37.3%), and largest errors (RMSE = 13.64, MAE = 4.46). Despite the poor performance of the GAMM with the inverse normal distribution, the overall results demonstrate that GAMMs are an effective tool for fitting and predicting cattle milk production variables, particularly when data are collected repeatedly from the same units over time. The GAMM with the lognormal distribution not only provided accurate predictions but also offered valuable insights into nonlinear relationships between milk production and household inputs. These insights can guide dairy farmers and policymakers in optimizing milk production by focusing on key factors such as improved breeding practices, proper feeding, health management, and labour efficiency. }, year = {2025} }
TY - JOUR T1 - Assessing the Efficiency of Generalized Additive Mixed Models (GAMMs) Using Milk Production Variables: Evidence from Tanzania’s National Panel Surveys AU - Zainabu Bonza AU - Rosalia Katapa AU - Amina Msengwa Y1 - 2025/09/26 PY - 2025 N1 - https://doi.org/10.11648/j.mma.20251002.12 DO - 10.11648/j.mma.20251002.12 T2 - Mathematical Modelling and Applications JF - Mathematical Modelling and Applications JO - Mathematical Modelling and Applications SP - 31 EP - 42 PB - Science Publishing Group SN - 2575-1794 UR - https://doi.org/10.11648/j.mma.20251002.12 AB - The study aimed to evaluate the performance of Generalized Additive Mixed Models (GAMMs) in fitting and predicting cattle milk production variables in Tanzania. The study used the National Panel Survey data collected between 2012 and 2021. GAMM (gamma), GAMM (lognormal), and GAMM (inverse normal) were fitted, and their performance was evaluated using Akaike Information Criterion (AIC), proportional of deviance explained, Root Mean Squared Error (RMSE), and Mean Absolute Error (MAE). The findings show that the GAMM with the lognormal distribution performed best, having a balanced good fit and predictive performance (AIC=4714.36, deviance explained = 94%, RMSE = 4.72, and MAE=2.94). Although the GAMM with the gamma distribution had a slightly better prediction accuracy (RMSE = 4.27 and MAE =2.77), it had a higher AIC (5027.75) and a smaller proportion of deviance explained (59%), making it less suitable for identifying factors affecting cattle milk production. The GAMM with the inverse normal distribution showed the poorest performance, with the highest AIC (5366.34), lowest deviance explained (37.3%), and largest errors (RMSE = 13.64, MAE = 4.46). Despite the poor performance of the GAMM with the inverse normal distribution, the overall results demonstrate that GAMMs are an effective tool for fitting and predicting cattle milk production variables, particularly when data are collected repeatedly from the same units over time. The GAMM with the lognormal distribution not only provided accurate predictions but also offered valuable insights into nonlinear relationships between milk production and household inputs. These insights can guide dairy farmers and policymakers in optimizing milk production by focusing on key factors such as improved breeding practices, proper feeding, health management, and labour efficiency. VL - 10 IS - 2 ER -