Machine learning analysis of subsistence determinants in Peruvian agricultural systems: A multi-regional approach using random forest and gradient boosting

Authors

  • Alejandro Coloma-Paxi Proyecto Mejoramiento del Sistema de Información Estadística Agraria y del Servicio de Información Agraria para el Desarrollo Rural del Perú (PIADER), Unidad Ejecutora de Gestión de Proyectos Sectoriales (UEGPS), Ministerio de Desarrollo Agrario y Riego del Perú, Lima, Peru.
  • José Antonio Otoya-Barrenechea Proyecto Mejoramiento del Sistema de Información Estadística Agraria y del Servicio de Información Agraria para el Desarrollo Rural del Perú (PIADER), Unidad Ejecutora de Gestión de Proyectos Sectoriales (UEGPS), Ministerio de Desarrollo Agrario y Riego del Perú, Lima, Perú. https://orcid.org/0009-0007-0702-6958 (unauthenticated)
  • Edward Añaguari-Palomino Proyecto Mejoramiento del Sistema de Información Estadística Agraria y del Servicio de Información Agraria para el Desarrollo Rural del Perú (PIADER), Unidad Ejecutora de Gestión de Proyectos Sectoriales (UEGPS), Ministerio de Desarrollo Agrario y Riego del Perú, Lima, Perú. https://orcid.org/0009-0006-8236-7819 (unauthenticated)
  • Andrés Ladislao Cornejo-Pinto Escuela Profesional de Ingeniería Agroindustrial, Universidad Nacional del Altiplano, Puno, Perú. https://orcid.org/0009-0007-2094-6521 (unauthenticated)

DOI:

https://doi.org/10.17268/sci.agropecu.2026.47

Keywords:

subsistence agriculture, machine learning, Random Forest, smallholder farmers, agricultural commercialization

Abstract

Subsistence agriculture persists across Peru with markedly heterogeneous patterns among ecological regions, yet multi-regional analyses using predictive methods remain scarce. This study identified determinants of household subsistence using random forest and gradient boosting classifiers. Microdata from the 2024 Peruvian National Agricultural Survey yielded 34,827 agricultural units after quality control. Subsistence was operationalised as the share of self-consumption in total production value and categorised as low (0% - 20%), medium (20% - 60%) and high (> 60%). On a held-out test set of 10,448 units both algorithms converged (random forest 82.9%, gradient boosting 82.6% accuracy), yet a nested sensitivity analysis showed that this performance depends substantially on predictors that enter the definition of the dependent variable. Once income-derived and market-participation variables were removed, accuracy settled at 65.7% against a 57.9% majority-class baseline, and harvested area and input expenditure emerged as the leading structural determinants. Three findings run against prevailing narratives. First, productive richness does not accompany commercialisation: Andean units combined the highest richness (7.9 versus 5.8 species on the Coast) with the highest subsistence (39.1% versus 15.0%). Second, direct-to-consumer selling was associated with higher subsistence (34.2%) than collector intermediation (14.3%), consistent with intermediaries operating as a pragmatic commercialisation route rather than a barrier. Third, accuracy was lowest precisely in the Andes (77.0%), where subsistence concentrates, and weakest for the transitional medium class (60.7%). Reporting predictive performance without separating definitional from structural predictors overstates what such models explain, a distinction rarely made in this literature.

References

Abdullahi, M. A., Muse, A. H., Muse, Y. H., Hassan, M. A., & Nadarajah, S. (2026). Harvests under heat: Quantifying the long-run impacts of climate and fertilizers on Somalia cereal yields: An ARDL analysis. Earth Systems and Environment, 10(5), 6599-6610. https://doi.org/10.1007/s41748-025-00972-w

Akber, M. A., Islam, M. A., Rahman, M. M., & Rahman, M. R. (2022). Crop diversification in southwest coastal Bangladesh: Insights into farming adaptation. Agroecology and Sustainable Food Systems, 46(2), 316-324. https://doi.org/10.1080/21683565.2021.1989105

Aniye, H. W., Bekele, T., & Worku, W. (2025). Trends of climate variability and its association with farmers' perceptions of climate change in Gassera district, southeastern Ethiopia. Scientific Reports, 15(1), Article 4399. https://doi.org/10.1038/s41598-025-89017-w

Asamoah, E., Heuvelink, G. B. M., Chairi, I., Bindraban, P. S., & Logah, V. (2024). Random forest machine learning for maize yield and agronomic efficiency prediction in Ghana. Heliyon, 10(17), e37065. https://doi.org/10.1016/j.heliyon.2024.e37065

Blanco, M., Mosquera, L. E., Crisostomo, D., Díaz Casana, C., Ritter, T., & Mockshell, J. (2024). Exploring cacao business models and agroecological transitions in Ucayali, Peru (Agroecological Transitions Program Report). Bioversity International and International Center for Tropical Agriculture.

Breiman, L. (2001). Random forests. Machine Learning, 45(1), 5-32. https://doi.org/10.1023/A:1010933404324

Calderan Gregolin, A., Contreras, M., Salgado-Funes, E., Tejada, G., & Zabaleta, I. (2023). The use of efficient Smart Agro 4.0 irrigation systems for cotton in Peru and its public policy implications. World Water Policy, 9(4), 746-755. https://doi.org/10.1002/wwp2.12157

Coelho da Silva, T. L., Furtado, L. S., Fernandes, G. S., Fernandes de Macêdo, J. A., Almada Cruz, L., Pires Magalhães, R., & Amorim Gomes, L. G. (2025). Machine learning methods and models to predict food insecurity levels for families in Ceará, Brazil, based on employment, housing and other social indicators. Journal of the Brazilian Computer Society, 31(1), 203-218. https://doi.org/10.5753/jbcs.2025.3100

Cole, R. (2022). Cashing in or driving development? Cross-border traders and maize contract farming in northeast Laos. Journal of Agrarian Change, 22(1), 139-161. https://doi.org/10.1111/joac.12460

Donkor, E. A., Garnevska, E., Siddique, M. I., & Donk or, E. (2021). Determinants of rice farmer participation in the direct marketing channel in Ghana. Sustainability, 13(9), 5047. https://doi.org/10.3390/su13095047

Food and Agriculture Organization of the United Nations. (2025). The state of food and agriculture 2025: Addressing land degradation across landholding scales. FAO. Rome.

Friedman, J. H. (2001). Greedy function approximation: A gradient boosting machine. Annals of Statistics, 29(5), 1189-1232. https://doi.org/10.1214/aos/1013203451

Fuglie, K. O. (2018). Is agricultural productivity slowing? Global Food Security, 17, 73-83. https://doi.org/10.1016/j.gfs.2018.05.001

Gholami, S., Knippenberg, E., Campbell, J., Andriantsimba, D., Kamle, A., Parthasarathy, P., Sankar, R., Birge, C., & Lavista Ferres, J. (2022). Food security analysis and forecasting: A machine learning case study in southern Malawi. Data & Policy, 4, e33. https://doi.org/10.1017/dap.2022.25

Hastie, T., Tibshirani, R., & Friedman, J. (2009). The elements of statistical learning (2nd ed.). Springer. https://doi.org/10.1007/978-0-387-84858-7

Instituto Geográfico Nacional. (2023). Límites departamentales [Data set]. Plataforma Nacional de Datos Abiertos. https://www.datosabiertos.gob.pe/dataset/limites-departamentales

Instituto Nacional de Estadística e Informática. (2024). Encuesta Nacional Agropecuaria 2024: Ficha técnica. Dirección Nacional de Censos y Encuestas, INEI. https://proyectos.inei.gob.pe/iinei/srienaho/Descarga/DocumentosMetodologicos/2024-62/03_FICHA_TECNICA_ENA_2024.pdf

James, G., Witten, D., Hastie, T., & Tibshirani, R. (2013). An introduction to statistical learning with applications in R. Springer. https://doi.org/10.1007/978-1-4614-7138-7

Jebessa, G. M., Engura, T. T., & Bekele, A. E. (2026). Exploring the nexus between forest resource use, livelihood strategies, and household food security in Ethiopia. Discover Food, 6(1), Article 285. https://doi.org/10.1007/s44187-026-01021-9

Jimoh, A. K., Olawuyi, S. O., Balogun, T. A., & Ganiyu, M. O. (2024). Causal effect of agricultural diversification on smallholder farmers' welfare status in Nigeria. Research on World Agricultural Economy, 5(4), 458-480. https://doi.org/10.36956/rwae.v5i4.1223

Leah, J., Pradel, W., Cole, D. C., Prain, G., Creed-Kanashiro, H., & Carrasco, M. V. (2013). Determinants of household food access among small farmers in the Andes: Examining the path. Public Health Nutrition, 16(1), 136-145. https://doi.org/10.1017/S1368980012000183

Little, R. J. A., & Rubin, D. B. (2019). Statistical analysis with missing data (3rd ed.). Wiley. https://doi.org/10.1002/9781119482260

Louppe, G., Wehenkel, L., Sutera, A., & Geurts, P. (2013). Understanding variable importances in forests of randomized trees. Advances in Neural Information Processing Systems, 26, 431-439.

Lowder, S. K., Skoet, J., & Raney, T. (2016). The number, size, and distribution of farms, smallholder farms, and family farms worldwide. World Development, 87, 16-29. https://doi.org/10.1016/j.worlddev.2015.10.041

Lundberg, S. M., & Lee, S.-I. (2017). A unified approach to interpreting model predictions. Advances in Neural Information Processing Systems, 30, 4765-4774.

Ma, W., Rahut, D. B., Sonobe, T., & Gong, B. (2024). Linking farmers to markets: Barriers, solutions, and policy options. Economic Analysis and Policy, 82, 1102-1112. https://doi.org/10.1016/j.eap.2024.05.005

Mazenda, A. (2026). Predicting household food insecurity through a livelihood lens: A machine learning approach in rural Colombia. Journal of International Development, 38(5), 827-840. https://doi.org/10.1002/jid.70092

Mgomezulu, W. R., Chitete, M. M. N., Maonga, B. B., Kachingwe, L., Phiri, H. H., Mambosasa, M., & Folias, L. (2024). Does shifting from subsistence to commercial farming improve household nutrition and poverty? Evidence from Malawi, Tanzania and Nigeria. Research in Globalization, 8, 100201. https://doi.org/10.1016/j.resglo.2024.100201

Ministerio de Desarrollo Agrario y Riego. (2021). Metodología de la construcción del marco maestro muestral para la ENA-MIDAGRI y demás operaciones estadísticas en el periodo intercensal (1.ª ed.). Unidad Ejecutora Gestión de Proyectos Sectoriales, Proyecto PIADER. https://ena.midagri.gob.pe/media/attachments/2021/10/08/metodologia_construccion_mmm_ena-midagri.pdf

Mukashov, A., Robinson, S., Arndt, C., Thurlow, J., & Thomas, T. (2026). Systematic risk profiling: Assessing compounding economic risks in developing countries. Economic Modelling, 157, 107511. https://doi.org/10.1016/j.econmod.2026.107511

Nkurunziza, F., Kabanda, R., & McSharry, P. (2025). Enhancing poverty classification in developing countries through machine learning: A case study of household consumption prediction in Rwanda. Cogent Economics & Finance, 13(1), 2444374. https://doi.org/10.1080/23322039.2024.2444374

Nzira, J. E., & Chegere, M. J. (2025). Diversify and thrive: Panel data evidence on crop portfolio effects on farmer income and farm output market supply. Journal of Agriculture and Food Research, 24, 102339. https://doi.org/10.1016/j.jafr.2025.102339

Ogutu, S. O., Gödecke, T., & Qaim, M. (2020). Agricultural commercialisation and nutrition in smallholder farm households. Journal of Agricultural Economics, 71(2), 534-555. https://doi.org/10.1111/1477-9552.12359

Probst, P., Wright, M. N., & Boulesteix, A.-L. (2019). Hyperparameters and tuning strategies for random forest. WIREs Data Mining and Knowledge Discovery, 9(3), e1301. https://doi.org/10.1002/widm.1301

Solano-Jiménez, J., Abadía, R., Pinilla Palleja, R., & Martínez-Carrasco, L. (2026). Determinants of household food security in rural Uganda: Perceived needs as key predictors. Agriculture & Food Security, 15(1), Article 14. https://doi.org/10.1186/s40066-025-00594-5

Tesfaye, W., & Tirivayi, N. (2020). Crop diversity, household welfare and consumption smoothing under risk: Evidence from rural Uganda. World Development, 125, 104686. https://doi.org/10.1016/j.worlddev.2019.104686

Trivelli, C., & Berdegué, J. A. (2019). Rural transformation: Looking towards the future of Latin America and the Caribbean (2030 - Food, Agriculture and Rural Development in Latin America and the Caribbean No. 1). Food and Agriculture Organization of the United Nations. https://openknowledge.fao.org/handle/20.500.14283/ca5508en

Vallejo-Rojas, V., Rivera-Ferre, M. G., & Ravera, F. (2022). The agri-food system (re)configuration: The case study of an agroecological network in the Ecuadorian Andes. Agriculture and Human Values, 39(4), 1301-1327. https://doi.org/10.1007/s10460-022-10318-1

van Klompenburg, T., Kassahun, A., & Catal, C. (2020). Crop yield prediction using machine learning: A systematic literature review. Computers and Electronics in Agriculture, 177, 105709. https://doi.org/10.1016/j.compag.2020.105709

Vásquez Neyra, J. M., Gomes Haensel Schmitt, V., & Cequea, M. M. (2025). Sustainable circular strategies and short supply chains among smallholder producers: The case of Peru's Agroferias Campesinas. Agricultural and Food Economics, 13(1), 12. https://doi.org/10.1186/s40100-025-00423-0

Wilson, K. M., McCool, W. C., & Brenner Coltrain, J. (2024). Climate and oceanic condition changes influence subsistence economic adaptation through intensification on the central Andean coasts. Quaternary International, 689-690, 79-92. https://doi.org/10.1016/j.quaint.2023.07.002

Zantsi, S., Masola, L., & Shiba, W. (2026). Appropriate farmer classification is key to agricultural development: Rethinking subsistence agriculture in South Africa. International Journal of Social Economics, 53(8), 1288-1298. https://doi.org/10.1108/IJSE-04-2025-0401

Zhao, L., Yang, M., Min, S., & Qing, P. (2025). Prediction of household food insecurity in rural China: An application of machine learning methods. International Food and Agribusiness Management Review, 28(2), 296-316. https://doi.org/10.22434/ifamr1137

Downloads

Published

2026-09-07

Issue

Section

Original Articles

How to Cite

Coloma-Paxi, A., Otoya-Barrenechea, J. A., Añaguari-Palomino, E., & Cornejo-Pinto, A. L. (2026). Machine learning analysis of subsistence determinants in Peruvian agricultural systems: A multi-regional approach using random forest and gradient boosting . Scientia Agropecuaria, 17(3), 685-700. https://doi.org/10.17268/sci.agropecu.2026.47