Alirio Pena LaCruz
ANA 630
4/27/26
Final Project: Pharmacy Sales Analysis
Alirio Pena LaCruz
ANA 630
4/27/26
For this project, I worked with a pharmacy sales dataset that tracks daily sales from an
international retail pharmacy chain across multiple drug categories, along with time related
variables such as year, month, and weekday. The main goal was to understand how sales change
over time and to identify any consistent demand patterns. This is important in a pharmacy setting
because demand is not constant, and recognizing patterns can help with inventory decisions,
staffing, and general planning during specific seasons.
The dataset is already aggregated at the daily level, which makes it easier to focus on trends
instead of individual transactions. Because of that, the analysis is more about understanding
overall behavior rather than predicting single purchases. To approach this problem, I used several
different methods including multiple linear regression, logistic regression, MANOVA, principal
component analysis (PCA), and hierarchical clustering. The reason for using multiple methods
was to look at the data from different perspectives instead of relying on just one technique.
The first step was basic data cleaning. I converted the date column into a proper datetime format
so time based variables could be extracted correctly. I also removed the Hour column since it did
not make sense for the structure of the dataset and did not provide meaningful information for
daily level analysis. After that, I focused on the main drug category variables and time related
features.
To analyze the data, I applied multiple statistical and machine learning methods:
Multiple Linear Regression:
o
Logistic Regression:
o
Used to test whether variables like weekday and month have a statistically
significant effect across multiple drug categories at the same time.
Principal Component Analysis (PCA):
o
Sales were converted into a binary variable (high vs low) to model the probability
of a high demand day. This approach focuses more on classification rather than
exact prediction.
MANOVA (Multivariate Analysis of Variance):
o
Used to predict sales for one category (N02BE) based on other drug categories
and time variables. This helps identify relationships between categories and
whether certain variables move together.
Applied to reduce dimensionality and understand how much of the total variation
can be explained with fewer components.
Hierarchical Clustering:
Alirio Pena LaCruz
ANA 630
4/27/26
o Used to group days based on similarity in sales patterns, which helps identify
natural demand groupings.
Using this combination of methods allowed for both predictive analysis and exploratory analysis,
which gives a more complete understanding of the dataset.
The multiple linear regression model had relatively low performance, with an R² between 0.14
and 0.19. This means the model explains only a small portion of the variation in sales, suggesting
that important variables are missing from the dataset.
Even with that, some predictors were still meaningful. Drug categories such as M01AB, M01AE,
N02BA, and R03 showed strong positive relationships with N02BE, while R06 showed a
negative relationship. Additionally, weekend variables (especially Saturday and Sunday) were
statistically significant, indicating higher sales on those days.
The logistic regression model achieved an accuracy of about 0.59, which is only slightly better
than random guessing. This indicates that the model is not strong for prediction. However, the
direction of relationships was consistent with the linear regression results. Certain categories and
weekends increased the probability of high sales days, while others decreased it.
The MANOVA analysis showed strong results. Both weekday and month were statistically
significant across multiple drug categories. This confirms that time plays an important role in
influencing pharmacy sales and that demand is not random.
The PCA results showed that the first principal component explained about 21% of the total
variation. It required multiple components to explain most of the dataset, which suggests that the
data is complex and influenced by several underlying factors rather than one dominant pattern.
The PCA visualization also did not show clear separation by weekday, which reinforces that no
single variable fully explains demand patterns.
Hierarchical clustering produced some of the most useful insights. The model grouped the data
into three clusters that represent high, medium, and low sales days. One cluster consistently
showed higher values across most categories, while another showed lower values.
This indicates that even though predictive models were weak, there are still clear structural
patterns in the data.
Looking across all methods, the results show that pharmacy sales are influenced by multiple
factors and cannot be easily predicted with simple models. Regression and logistic regression
were not strong in terms of prediction accuracy, but they still helped identify important
relationships between variables.
Alirio Pena LaCruz
ANA 630
4/27/26
The MANOVA results confirmed that time variables such as weekday and month have a
significant impact across all categories. This supports the idea that demand follows temporal
patterns rather than being random.
PCA showed that the dataset has multiple underlying patterns, which explains why simpler
models struggled. There is not just one main driver of sales, but several interacting factors.
Clustering provided the most practical value. By grouping days into high, medium, and low
demand, it makes a way to simplify decision making. Instead of predicting exact values, a
pharmacy could focus on identifying which type of day is likely to occur and plan accordingly
weeks in advance.
This analysis shows that pharmacy sales follow clear patterns, but they are not easy to predict
precisely using basic models. Time variables like weekday and month play a major role, and
different drug categories are also related to each other.
Even though regression and classification models did not perform well, clustering revealed
meaningful groupings of demand levels. This is likely the most useful result from a business
perspective because it can directly support planning decisions.
Using multiple methods made it possible to understand the data more completely. Instead of
relying on a single model, combining approaches helped uncover both relationships and structure
within the dataset. Overall, this type of analysis can help pharmacies better prepare for changes
in demand and improve operational planning.