Leveraging Big Data, Weather Insights, and the XGBoost ML Model to Better Forecast Medication Demand and Manage Shortages

preprint OA: closed CC-BY-4.0
AI-generated summary by claude@2026-07, 2026-07-17

This study found that XGBoost models incorporating lagged weather variables significantly improved demand forecasting for immunological products and vaccines compared to other machine learning approaches.

One-sentence paraphrase of the abstract; not a substitute for reading it. No clinical advice. How this works

Abstract

Abstract Background Medication shortages are a critical public health issue, exacerbated by inaccurate demand forecasting, particularly for medicines with irregular demand patterns. External factors like weather conditions may influence demand variability, offering an avenue for improving predictive accuracy. Methods This study utilized 10 years of medication prescription data from the NHS English Prescribing Dataset (EPD) and weather data from the Meteostat API. The focus was on immunological products and vaccines, as these demonstrated high variability in demand and frequent stockouts. Weather variables (temperature, precipitation, wind speed, etc.) and their lagged values were used as predictors in machine learning (ML) models: Linear Regression, Random Forest, and XGBoost. Model performance was evaluated using metrics such as R², RMSE, and MAE. Results XGBoost emerged as the best-performing model, with an R² of 0.80, RMSE of 324.61, and MAE of 117.69, outperforming Random Forest (R² = 0.67) and Linear Regression (R² = 0.04). The analysis highlighted the significant role of lagged weather variables, such as minimum temperature and precipitation, in predicting demand for immunological products. Conclusions The study demonstrates the potential of incorporating weather data into ML models to improve medication demand forecasting, particularly for medicines with irregular demand patterns. XGBoost offers a robust framework for mitigating medication shortages through accurate, dynamic demand prediction.
Full text 10,736 characters · extracted from preprint-html · click to expand
Leveraging Big Data, Weather Insights, and the XGBoost ML Model to Better Forecast Medication Demand and Manage Shortages | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Research Article Leveraging Big Data, Weather Insights, and the XGBoost ML Model to Better Forecast Medication Demand and Manage Shortages Mesay Menebo This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-5759776/v1 This work is licensed under a CC BY 4.0 License Status: Posted Version 1 posted You are reading this latest preprint version Abstract Background Medication shortages are a critical public health issue, exacerbated by inaccurate demand forecasting, particularly for medicines with irregular demand patterns. External factors like weather conditions may influence demand variability, offering an avenue for improving predictive accuracy. Methods This study utilized 10 years of medication prescription data from the NHS English Prescribing Dataset (EPD) and weather data from the Meteostat API. The focus was on immunological products and vaccines, as these demonstrated high variability in demand and frequent stockouts. Weather variables (temperature, precipitation, wind speed, etc.) and their lagged values were used as predictors in machine learning (ML) models: Linear Regression, Random Forest, and XGBoost. Model performance was evaluated using metrics such as R², RMSE, and MAE. Results XGBoost emerged as the best-performing model, with an R² of 0.80, RMSE of 324.61, and MAE of 117.69, outperforming Random Forest (R² = 0.67) and Linear Regression (R² = 0.04). The analysis highlighted the significant role of lagged weather variables, such as minimum temperature and precipitation, in predicting demand for immunological products. Conclusions The study demonstrates the potential of incorporating weather data into ML models to improve medication demand forecasting, particularly for medicines with irregular demand patterns. XGBoost offers a robust framework for mitigating medication shortages through accurate, dynamic demand prediction. Invariable demand Medication forecasting Medication shortage Weather data Machine learning models resource optimization Full Text Additional Declarations No competing interests reported. Cite Share Download PDF Status: Posted Version 1 posted You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-5759776","acceptedTermsAndConditions":true,"allowDirectSubmit":true,"archivedVersions":[],"articleType":"Research Article","associatedPublications":[],"authors":[{"id":427572595,"identity":"d6ce259c-6f51-4e88-a294-039a6cb49537","order_by":0,"name":"Mesay Menebo","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAABI0lEQVRIie3SsUrDQBjA8a8etMsF14RA8gpXAilBwdHXaPari0sHwYKQLAFXhUJfIV2KboGDZjn3EwUbAs3STRCDovaSxcHc7HD/4Qsk/OAudwA63T+MZM2DNRNh+QZQpiRB+7lqybwh/bGSnLTkuyWfDcFESfw8Ll4xPDnuabxBdPrsjAbJm1XfwdlhF+Hcs/fEG3JOEOVbL0geVrbB4dyadRBBQZJweUMBTSIWpmKysnsRhGn2NyEvVfmBgYXLRbVBxhe7TAXdWrWKCPBtSRYmEGTM2JgI2jcNFeHUD+aEeQRTwvCaDe+TtXdkRGZ427EXkuel2E2Z48Z5UeIL5o4GV8VjHR2H1x1/THYgD0Jeg98rMRUAoPe+H27HMnQ6nU4HP1qyZVf/P5lzAAAAAElFTkSuQmCC","orcid":"","institution":"University of South-Eastern Norway","correspondingAuthor":true,"prefix":"","firstName":"Mesay","middleName":"","lastName":"Menebo","suffix":""}],"badges":[],"createdAt":"2025-01-03 17:23:10","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-5759776/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-5759776/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":99792278,"identity":"2e61edd2-34f4-49bf-9bb2-93cd8de7ec74","added_by":"auto","created_at":"2026-01-08 13:17:22","extension":"pdf","order_by":1,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":1140392,"visible":true,"origin":"","legend":"","description":"","filename":"LeveragingBigDataWeatherInsightsandtheXGBoostMLModeltoBetterForecastMedicationDemandandManageShortages.pdf","url":"https://assets-eu.researchsquare.com/files/rs-5759776/v1_covered_cbe27d08-2be5-4c45-8898-f4f540632787.pdf"}],"financialInterests":"No competing interests reported.","formattedTitle":"Leveraging Big Data, Weather Insights, and the XGBoost ML Model to Better Forecast Medication Demand and Manage Shortages","fulltext":[],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":false,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":false,"hideJournal":true,"highlight":"","institution":"","isAcceptedByJournal":false,"isAuthorSuppliedPdf":true,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":true,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true},"keywords":"Invariable demand, Medication forecasting, Medication shortage, Weather data, Machine learning models, resource optimization","lastPublishedDoi":"10.21203/rs.3.rs-5759776/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-5759776/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"\u003cp\u003e\u003cstrong\u003eBackground\u003c/strong\u003e\u003cbr\u003e\nMedication shortages are a critical public health issue, exacerbated by inaccurate demand forecasting, particularly for medicines with irregular demand patterns. External factors like weather conditions may influence demand variability, offering an avenue for improving predictive accuracy.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eMethods\u003c/strong\u003e\u003cbr\u003e\nThis study utilized 10 years of medication prescription data from the NHS English Prescribing Dataset (EPD) and weather data from the Meteostat API. The focus was on immunological products and vaccines, as these demonstrated high variability in demand and frequent stockouts. Weather variables (temperature, precipitation, wind speed, etc.) and their lagged values were used as predictors in machine learning (ML) models: Linear Regression, Random Forest, and XGBoost. Model performance was evaluated using metrics such as R², RMSE, and MAE.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eResults\u003c/strong\u003e\u003cbr\u003e\nXGBoost emerged as the best-performing model, with an R² of 0.80, RMSE of 324.61, and MAE of 117.69, outperforming Random Forest (R² = 0.67) and Linear Regression (R² = 0.04). The analysis highlighted the significant role of lagged weather variables, such as minimum temperature and precipitation, in predicting demand for immunological products.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eConclusions\u003c/strong\u003e\u003cbr\u003e\nThe study demonstrates the potential of incorporating weather data into ML models to improve medication demand forecasting, particularly for medicines with irregular demand patterns. XGBoost offers a robust framework for mitigating medication shortages through accurate, dynamic demand prediction.\u003c/p\u003e","manuscriptTitle":"Leveraging Big Data, Weather Insights, and the XGBoost ML Model to Better Forecast Medication Demand and Manage Shortages","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2025-04-02 11:44:43","doi":"10.21203/rs.3.rs-5759776/v1","editorialEvents":[{"type":"communityComments","content":0}],"status":"published","journal":{"display":true,"email":"[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"f21ebdee-2bb8-4a9e-a922-c2cec3678ad1","owner":[],"postedDate":"April 2nd, 2025","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"posted","subjectAreas":[],"tags":[],"updatedAt":"2026-01-06T03:39:25+00:00","versionOfRecord":[],"versionCreatedAt":"2025-04-02 11:44:43","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-5759776","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-5759776","identity":"rs-5759776","version":["v1"]},"buildId":"8U1c8b4HqxoKbykW_rLl7","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}

Text is read by the "Ask this paper" AI Q&A widget below. Extraction quality varies by source — PMC NXML preserves structure cleanly, OA-HTML may include some navigation residue, and OA-PDF can have broken hyphenation. The publisher copy (via DOI) is the canonical version.

My notes (saved in your browser only)

Ask this paper AI returns verbatim quotes from the full text · source: preprint-html

Answers must be backed by verbatim quotes from this paper's full text. Hallucinated quotes are dropped automatically; if no verbatim passage answers the question, we say so. How this works

Citation neighborhood (no data yet)

We don't have any in-corpus citations linked to this paper yet. This is a recent paper (2025) — citers typically take a year or two to land, and the OpenAlex reference graph may still be filling in.

Source provenance

europepmc
last seen: 2026-05-20T01:45:00.602351+00:00
unpaywall
last seen: 2026-05-27T02:00:06.600101+00:00
License: CC-BY-4.0