Medicine Forecast
Medicine Forecast
How to cite this paper: Souza, E. F. S., Silva Neto, A. R. (2024). Medicine demand forecasting: An assessment of a private
hospital in Pernambuco. Socioeconomic Analytics, 2(1), 61-73. https://doi.org/10.51359/2965-4661.2024.260168
Keywords
1. Introduction
to make resource allocation decisions every day, even in times of uncertainty, as ensuring
service delivery is the core activity of these organizations. In general, it is possible to observe
that the predictions of these demands are carried out without the support of a formal method,
simply based on empiricism and the experience of managers (Enami, 2021).
In this context, Neto & Filho (1998) states that medicines have great impact on logistics
management, given that they are items of high importance for the process of basic care for
patients in a hospital unit. Given the high number of products with varied demand behavior
patterns and inherent peculiar characteristics medicines, the need for differentiated control
increases (Santos & Rodrigues, 2006). Therefore, time series models prove to be an excellent
tool to predict demands and assist managers in their planning and control. According to Nielsen
(2021) time series analysis leads us to understand statistical information from data points from
a chronological order, given their temporal characteristic, in order to understand past events to
predict future behaviors.
Furthermore, it is important to highlight the urgent nature of the care provided by a hospital
unit, given that a failure or lack of medication may result in the loss of a patient's life. Therefore,
when talking about medicines dispensed in the urgency and emergency sector of a hospital
unit, use methods and techniques that enable the managing and forecasting demand in the most
accurate way possible is necessary and essential. It should be noted that it is with this data that
senior management is able to outline the better purchasing, acquisition, distribution strategies,
etc.
Taking into account that an estimate of future demand is fundamental and essential in the
daily lives of organizations, this work aims to test the different demand forecasting models
applied specifically to 27 different medicines that were selected based on the ABC curve,
dispensed exclusively in the urgency and emergency of a private hospital unit, located in the
interior of Pernambuco. In addition to this introductory section, the article is organized as
follows: section 2 presents a theoretical review of demand forecasting. Section 3 describes the
proposed method, whose results are presented in section 4. Finally, section 5 closes the study
with the conclusions and suggestions for future work.
2. Theoretical Reference
and purchasing plans, seeking to minimize errors and meeting the demands (Cecatto &
Belfiore, 2015).
The Weighted Moving Average (MMP) is also a simple demand forecast model, with
greater flexibility than the MMS, which requires the attribution of different weights to the
values of the time series (Corrar & Theophilo, 2008). The weights are distributed
exponentially, with more recent values receiving greater weights and more recent weights old
ones with lower weights. From the exponential smoothing of the MMP it is possible generate
forecasts for future periods, as long as the effect of the trend is small or non-existent. As can
be seen, even though it is simple and flexible, MMP has limitations for identify more complex
patterns in a time series.
It is also possible that the series of the problem in question has volatility and to deal with
Therefore, Simple Exponential Smoothing (SES) techniques are an excellent alternative
(Morettin & Toloi, 2018). SES techniques admit that these extreme values of the series
temporal values are random and, therefore, they use methods to smooth these values in order
to identify patterns.
On the other hand, the Holt-Winters model incorporates seasonality and trend into its
calculations and is considered an extension of the Holt model, which captures seasonal
fluctuations that happen regularly over a given period of time. This method involves applying
of three equations to estimate the level, trend and seasonality of a time series. This one model
is widely used in various fields, such as sales forecasting, energy demand, climate forecast, etc
(Hyndman & Athanasopoulos, 2018). This technique is one of the more powerful for modeling
time series with seasonality.
The Autoregressive Integrated Moving Average (ARIMA) model consists of a time series
forecasting that combines autoregressive linear regression (AR) with moving average (MA)
and differencing, to make the time series stationary. Areas such as finance, economics,
engineering and social sciences use this method very rigorously to predict time series (Box &
Jenkins, 1970). The Seasonal Autoregressive Integrated model Moving Average (SARIMA) is
an extension of the ARIMA model, which considers seasonality of series allows the forecasting
of seasonal time series. Brockwell & Davis (2016) discuss that the SARIMA model takes into
account seasonal differences and seasonal AR components and MA.
3. Methodology
This work was developed at the Pharmaceutical Supply Center (CAF) of a private hospital
in the city of Caruaru, Pernambuco. Unimed Caruaru Hospital (HUC) has more than 417
cooperating doctors divided into 45 specialties and more than 80 thousand customers. Its area
of activity covers more than 50 cities in Pernambuco. The HUC CAF is responsible for
ensuring the supply, distribution, access, control, traceability and rational use of medicines and
materials, including medicines dispensed to the urgency and emergency sector for use by
patients receiving care at the hospital. It is worth noting that the CAF operates 24 hours a day,
dividing work shifts into two 12-hour shifts, with 36 hours off, better known as a 12x36 shift.
The research method of the work consists of four stages as shown in Figure 1.
In stage 1, the demand for more accurate predictions related to the most commonly used
medications in the hospital's emergency department was identified. This is due to the fact that
this sector acts as the main entrance for patients and also records the greater volume of
medication administration on a daily basis. Furthermore, when there is a advance knowledge
about the quantity that will be consumed, greater power can be obtained negotiating with
suppliers and consequently making more assertive purchases and exact time.
In stage 2, data was collected through the company's information system, obtaining the
monthly consumption report by product from January 2019 to December 2022, thus, analyzing
this mass of data for the subsequent creation of the historical series in which the models were
based. The output records of 620 different products were used, where 27 were chosen after
classification and analysis of the ABC curve. At this stage, graphs of the real demands of the
product under study, in order to detect seasonality, level, trend and cycle components.
Statistical tests were also carried out in order to validate some hypotheses of the demands
obtained.
Stage 3 included the application of demand forecasting methods of Simple Moving
Average (MMS), Weighted Moving Average (MMP), Simple Exponential Smoothing (SES),
Holt-Winters Additive and Multiplicative, ARIMA and SARIMA. The models were applied
twice, using the parameters for the models in two ways, the first way random and the second
using the Grid Search technique, with MMS being discarded the second time, because the only
parameter used was the 3-day time window to start forecasting. At in a random manner, all
parameters were defined based on the researchers' previous experience with demand forecast
models. In the second, Grid Search was used, which is a hyperparameter optimization
technique capable of testing all possible combinations in order of finding the best combination
that maximizes the chosen evaluation metric. The choices of the parameters took into account
the lowest information criterion Akaike Information Criterion (AIC) and Rout Mean Square
Error (RMSE) found during search and optimization. The models were developed and
integrated in Python, using Visual Studio Code.
Finally, in step 4, the applied models were analyzed in order to identify the model that
predicts with greater accuracy, where the Mean Absolute Percentage was selected at the time
Error (MAPE), given its advantages of independence of scales and interpretation.
4. Results
From the analysis of medication dispensing data, it is evident that the time series show
multiple fluctuations over time. To assess the stationarity of the data and allow the use of
appropriate models, a statistical test, the ADF test, was performed using a significance level of
0.05. The results found for the product demands can be seen in Table 1.
The values obtained indicated that the demands for products P3, P4, P9, P10, P11, P12,
P13, P14, P15, P18, P19, P21, P25 and P26 do not accept the null hypothesis, that is, they are
considered non-stationary. On the other hand, the demands of the other products reject the null
hypothesis, indicating that they are stationary
Figure 2 confirmed that the data were stationary, which was corroborated by the ACF and
PACF charts corresponding to the products. With stationary data, it was possible continue with
the application of forecasting models.
After stationarizing all data series, all data series were applied.the proposed models. These
models were implemented with parameters selected from in a random manner, with the purpose
of obtaining initial results and subsequent evaluation of their values. After obtaining these
preliminary results, we proceeded to identify the most effective models for each product, as
detailed in Table 4.
In addition to selecting the optimized models, the percentage discrepancies between the
generated forecasts and the observed demands for the respective period were also assessed.
The specific values of the constant parameters used in each selected model were set to [0.3,
0.1, 0.1], representing, respectively, the parameters associated with the level, trend and
seasonality. As far as the ARIMA model is concerned, the coefficients [1, 1, 1] were used for
the values of parameters p, d and q.
Subsequently, the Grid Search technique was used, which consists of carrying out a search
systematically and exhaustively in a pre-defined search space to find the best hyperparameters
of the models. This technique consists of carrying out a systematic search for a grid of
previously defined parameter values for each model. To implement the methodology, a
continuous interval was adopted in the domain of values between 0 and 1. The discretization
of this interval was carried out in increments of 0.01, 0.05 and 0.1 for the different models,
namely, Weighted Moving Average (MMP), Smoothing Simple Exponential (SES), Holt and
Holt-Winters. In the case of ARIMA and SARIMA models, the exploration of the parameter
space covered only the components p, d and q, with the pertinent values derived from the sets
[5, 2, 5] and [10, 2, 5].
The temporal results acquired during the exploration of each model were organized in a
tabular format, as presented in Table 5. This meticulous search aimed at identification of
optimized parameters can be conceptualized as a component of significant importance in the
context of obtaining predictions characterized by high accuracy and efficiency. Consequently,
this approach strengthens the foundations underlying the decisions assertive decision-making.
After determining the optimal forecast parameters for each interval defined with in relation
to each product, a subsequent step involved carrying out additional projectionsdemand, with
the aim of capturing the results arising from the implementation of theseidentified parameters.
Subsequently, a thorough analysis was conducted to evaluate the outstanding results obtained,
accompanied by a meticulous evaluation of the confidence intervals associated with the models
adopted. The models that demonstrated the most promising models, categorized as the best
models, are summarized in Table 6.
Table 6: Best models with best parameters and associated errors by product
Through the evaluation of the optimal models derived from the application of the search
method in grid (Grid Search) and models based on random parameter selection, was conducted
an analysis aimed at identifying possible improvements in the accuracy metrics of these
models. This assessment allowed the determination of the most appropriate models for each
item under investigation, taking into account the results obtained in a new prediction phase. A
Precision analysis revealed notable reductions in error values associated with the products
listed in Table 8, in addition to investigating whether the models maintained their integrity or
suffered some form of adjustment. On the other hand, Table 7 lists the scenarios in which the
models do not were subject to any modification.
With regard to the models used for each product, it is noteworthy that the Holt-Winters
Additive has been successful in providing the most accurate estimates for forecasting of 21
different medicines. This success can be attributed to the characteristics of the products in
exhibit seasonality of constant magnitude, which does not vary according to oscillations of the
time series. This translates into the fact that the amplitude of seasonal variations remains
invariable over time.
An additional aspect of notable interest lies in the observation that, among the group made
up of the 21 medications listed previously, of the total, 12 items demonstrated values equal to
your parameters. In this scenario, it can be assertively inferred that the search exploration
approach of the Grid Search method gave considerable emphasis to the most important data
recent, since the parameter values are close to 1.
In Table 9 it is possible to observe the results of some of the drugs studied, as well as such
as comparing their respective forecasts for the last four months, in addition to forecasts for the
entire year 2023. In summary, the Holt-Winters Additive model was identified as the most
suitable for 78% of medicines, presenting the best results in terms of accuracy. Those results
provide valuable information for decision making regarding forecasting demand for the
products investigated, allowing a more precise and efficient approach to inventory management
and demand planning.
5. Conclusions
The objective of this study was to establish a comparison between different models
demand forecast for medicines that are dispensed to the emergency service and emergency,
within a private hospital located in the Agreste region of Pernambuco. After a systematic
evaluation of the results obtained, and a subsequent selection of the most appropriate for each
of the 27 medications in question, it was identified that the Holt Winters Additive model was
the most suitable for 21 medications, the Holt-Winters Multiplicative model proved to be
suitable for 3 medications, and the remaining three medications were better predicted by the
ARIMA model. These selected models are intended to be used in the CAF and in the
Pharmacies of the researched hospital itself, with the purpose of optimizing the procedures
related to the acquisition, dispensing and storage of the medicines under analysis.
The results obtained indicated that the Holt-Winters Additive model demonstrated a
greater accuracy in predictions for 78% of the medicines considered. These results were
obtained through the application of the Grid Search method, which allowed the identification
of the most effective parameters for each model. These parameters were then compared with
predefined values, generated randomly. Note, however, that Even after this analysis, six
medications showed superior performance when parameters were determined by the
researchers, even if in a reduced proportion. Nevertheless, the institution chose to adopt the
selected models, seeking to assess whether the discrepancies and accuracy of the forecasts were
in line with the projections provided by the higher performance model.
It is important to highlight some limitations of this research, which restricted its attention
to one specific sector within a single hospital. However, it is pertinent to emphasize the
relevance of future research that can explore the generalization of the results obtained in this
study to other hospital institutions in the same region. Furthermore, it would be beneficial to
conduct a comprehensive assessment of models across all medicines to understand the behavior
of their respective demands.
Future research could target alternative forecasting techniques and more robust models
sophisticated, as well as incorporating additional variables of relevance in order to increase the
forecast accuracy and optimize supply chain management. It is, moreover, plausible to examine
the effectiveness and complexity involved in the search for hyperparameters, since certain
values in the search space may present subtle or insignificant differences in relation to the pre-
defined intervals. Furthermore, the feasibility of investigating the effectiveness and effort
associated with the application of hyperparameter search techniques is considered, notably with
regard to refers to the discrepancy observed in certain values in the search space, where
variations in the intervals 0.01 and 0.05 they showed reduced or insignificant divergence. This
implies also assess whether the time spent determining these parameters has an impact positive
in the forecasting process. Furthermore, the possibility of optimizing and standardizing
medication quotas or using dispensing systems in the unit is considered, in order to reduce the
volume of stock and increase the accuracy of forecast estimates.
Acknowledgement
We thank the Unimed Caruaru Hospital for the opportunity to develop this work in the
institution.
References
1. ALBRECHT, J. S., WICKWIRE, E. M., VADLAMANI, A., SCHARF, S. M., & TOM,
S. E. (2019). Trends in insomnia diagnosis and treatment among Medicare
beneficiaries, 2006–2013. The American Journal of Geriatric Psychiatry, 27(3), 301–
309.
2. ASSUMPÇÃO, G. O., & ROSA, V. A. O. (2022). Aplicação de método quantitativo
de previsão de demanda em uma doceria. In XLII Encontro Nacional de Engenharia de
Produção - ENEGEP. Foz do Iguaçu/PR.
3. BALLOU, R. H. (2006). Gerenciamento da Cadeia de Suprimentos: Logística
Empresarial (5a ed.). Porto Alegre: Bookman.
4. BOX, G. E. P., & JENKINS, G. M. (1970). Time Series Analysis: Forecasting and
Control. San Francisco: Holden-Day.
5. BROCKWELL, P. J., & DAVIS, R. A. (2016). Introduction to Time Series and
Forecasting. Springer.
6. CECATTO, C., & BELFIORE, P. (2015). O uso de métodos de previsão de demanda
nas indústrias alimentícias brasileiras. Gestão e Produção, 22(2), 404–418.
7. CORRAR, L. J., & THEOPHILO, C. R. (2008). Pesquisa Operacional Para Decisão em
Contabilidade e Administração: contabilometria. São Paulo: Atlas.
8. ENAMI, L. M. (2021). Previsão de séries temporais sazonais no controle de estoque de
medicamentos oncológicos de alto custo (Dissertação de Mestrado, Universidade
Estadual de Maringá).
9. FANG, Y., WANG, X., & YAN, J. (2020). Green product pricing and order strategies
in a supply chain under demand forecasting. Sustainability (Switzerland), 12(2).
10. FERNANDES, F. C. F., & FILHO, M. G. (2010). Planejamento e Controle da Produção
– Dos Fundamentos ao Essencial. São Paulo: Editora Atlas.
11. HAQ, A. U., ZEB, A., LEI, Z., & ZHANG, D. (2021). Forecasting daily stock trend
using multi-filter feature selection and deep learning. Expert Systems with
Applications, 168, 114444.
12. HYNDMAN, R., & ATHANASOPOULOS, G. (2018). Forecasting: Principles and
Practice (2nd ed.). Melbourne, Australia: OTexts.
13. KARLIN, S. (2014). A First Course in Stochastic Processes. Academic Press.
14. KOTLER, P., & KELLER, K. (2012). Administração de Marketing (14th ed.). Pearson.
15. LUSTOSA, L., MESQUITA, M. A., & OLIVEIRA, R. J. (2008). Planejamento e
Controle da Produção. Elsevier Brasil.
16. MAKRIDAKIS, S., HYNDMAN, R. J., & PETROPOULOS, F. (2020). Forecasting in
social settings: The state of the art. International Journal of Forecasting, 36(1), 15–28.
17. MOREIRA, D. A. (2008). Administração da Produção e Operações (2nd ed.). São
Paulo: Cengage Learning.
18. MORETTIN, P. A., & TOLOI, C. M. C. (2018). Modelos de suavização exponencial.
In Análise de Séries Temporais: Modelos lineares univariados (3rd ed.). São Paulo:
Edgard Blucher, v. 1, 108–129.
19. NETO, G. V., & FILHO, W. R. (1998). Gestão de Recursos Materiais e de
Medicamentos. São Paulo: Editora Fundação Peirópolis Ltda, 12.
20. NIELSEN, A. (2021). Análise Prática de Séries Temporais: Predição com Estatística e
Aprendizado de Máquina. Brasil: Alta Books.
21. PARMEZAN, A. R. S., SOUZA, V. M. A., & BATISTA, G. E. A. P. A. (2019).
Evaluation of statistical and machine learning models for time series prediction:
Identifying the state-of-the-art and the best conditions for the use of each model.
Information Sciences, 484, 302–337.
22. SANTOS, A. M., & RODRIGUES, I. A. (2006). Controle de estoque de materiais com
diferentes padrões de demanda: Estudo de caso em uma indústria química. Gestão
Produção, 13(2), 223–231.
23. ZHU, S., JAARSVELD, W. van, & DEKKER, R. (2020). Spare parts inventory control
based on maintenance planning. Reliability Engineering System Safety, 193, 106600.