CPOM Module 17, Section 3: Predictive Analytics for Forecasting and Optimization
MODULE 17: DATA ANALYTICS, INFORMATICS & DECISION SUPPORT

Section 3: Predictive Analytics for Forecasting and Optimization

From Rear-View Mirror to Windshield: Using Your Data to See the Future of Your Pharmacy.

SECTION 17.3

Predictive Analytics for Forecasting and Optimization

An introduction to advanced analytical techniques, moving beyond historical reporting to using your own data to forecast drug spend, predict patient volume, and optimize staffing levels.

17.3.1 The “Why”: The Shift from Reactive to Proactive

Thus far in this module, we have focused on using data to understand what has already happened. Descriptive analytics (the “what”) and diagnostic analytics (the “why”) are the bedrock of management. They allow you to report on your performance and explain the factors that drove it. This is akin to driving a car by looking exclusively in the rear-view mirror. You have a perfect, clear picture of the road you have already traveled, but you have no idea what lies beyond the next curve.

Predictive Analytics is the fundamental shift to looking through the windshield. It is the practice of using historical data, statistical algorithms, and machine learning techniques to identify the likelihood of future outcomes. This is the transition from a reactive manager—one who responds to problems as they arise—to a proactive, strategic leader who anticipates challenges and opportunities before they materialize. It is the single most powerful capability that separates good managers from truly great ones.

Imagine being able to answer these questions with a high degree of statistical confidence:

  • What will our expenditures on IVIG be next quarter, and will it put us over budget?
  • Which of our discharged heart failure patients are most likely to be readmitted within 30 days, and how can we intervene now?
  • Based on surgical schedules and historical patient census, what is the mathematically optimal number of pharmacy technicians we need to have on duty next Tuesday at 2 PM to keep our turnaround times within target?

These are not questions of fantasy; they are the practical, high-value questions that predictive analytics allows you to answer. This section is designed to demystify these advanced techniques. We will demonstrate that predictive analytics is not a “black box” of incomprehensible algorithms, but rather a logical extension of the clinical forecasting you already do every day. You will learn the foundational methods for forecasting, the types of models used to predict outcomes, and the data required to power them. This is your introduction to becoming a truly forward-looking, data-driven pharmacy leader who shapes the future rather than simply reacting to the past.

Pharmacist Analogy: The Flu Season Forecast

As a seasoned pharmacist, you are already an expert in predictive analytics; you just call it “preparing for flu season.” Your brain instinctively performs a sophisticated, multi-factorial analysis to anticipate future needs.

Let’s break down the different levels of analytics in this familiar context:

  • Descriptive Analytics (“What happened?”): You pull a report at the end of winter. “Last year, we dispensed 5,000 boxes of oseltamivir and administered 2,500 flu shots between October and March.” This is a simple, factual report of the past.
  • Diagnostic Analytics (“Why did it happen?”): You dig deeper. “The spike in oseltamivir dispensing in February correlated perfectly with a major influenza A (H1N1) outbreak at the two largest elementary schools in our county, which was widely reported in the local news.” You have now explained the cause of the historical data.
  • Predictive Analytics (“What will happen?”): This is where your expertise shines. You begin synthesizing future-looking data:
    • “The CDC’s early surveillance reports from the Southern Hemisphere suggest the dominant strain this year is H3N2, which tends to cause more severe illness in our elderly population.”
    • “The local school district has mandated flu shots for all students this year, which might decrease pediatric transmission.”
    • “Our own historical data shows a clear seasonal peak in oseltamivir use in the first two weeks of February, regardless of the dominant strain.”
    Based on this, you make a forecast: “I predict a 15% increase in demand for high-dose flu vaccines for our Medicare patients, and despite the school mandate, I still forecast a major spike in oseltamivir demand in early February. We need to increase our vaccine order by 20% and pre-order our oseltamivir stock by mid-January to avoid shortages.”

This is predictive analytics. You took multiple data sources—historical patterns, public health surveillance, local policy changes—and created a statistical (albeit informal) model to forecast the future and make a proactive operational decision. The methods we will discuss in this section simply provide a more formal, powerful, and scalable mathematical framework for the proactive, forward-looking thinking you already do every day.

17.3.2 The Analytics Maturity Model: A Roadmap to the Future

Organizations do not simply jump into predictive analytics overnight. They evolve their capabilities over time, moving through a well-defined continuum known as the Analytics Maturity Model. Understanding this model is crucial because it provides a roadmap for your department. It helps you identify where you are today, what the next logical step is, and what capabilities you need to develop to get there. The model progresses from looking at the past to shaping the future, with each level increasing in complexity and, more importantly, in the value it delivers to the organization.

1
Descriptive

What happened?

This is the foundation. It involves gathering, organizing, and visualizing historical data to provide a clear picture of the past. It is the source of all standard management reports and dashboards.

Pharmacy Examples: Monthly drug spend reports, daily ADC dispense logs, quarterly medication error summaries, standard KPI dashboards.

2
Diagnostic

Why did it happen?

This level moves beyond simply reporting the numbers to understanding the root causes behind them. It involves drilling down into the data, identifying anomalies, and uncovering relationships.

Pharmacy Examples: Analyzing a spike in drug spend to find it was driven by a single new high-cost medication; investigating a rise in turnaround times to discover a recurring printer malfunction; correlating an increase in ADEs with the rollout of a new CPOE order set.

3
Predictive

What will happen?

This is the forward-looking stage. Here, we use statistical models and machine learning on historical data to forecast future trends and predict the likelihood of specific outcomes.

Pharmacy Examples: Forecasting next month’s IVIG usage based on historical trends and seasonality; building a model to predict which patients are at high risk for an opioid-related adverse event; forecasting future staffing needs based on projected surgical volume.

4
Prescriptive

What should we do about it?

This is the most advanced and highest-value stage. It goes beyond predicting an outcome to recommending a specific course of action to optimize for the best possible result. It often involves simulation and optimization algorithms.

Pharmacy Examples: An optimization model that generates the perfect technician schedule to minimize labor costs while guaranteeing all turnaround time targets are met; a simulation that shows the inventory and budget impact of adding a new drug to the formulary; an AI system that recommends the ideal antibiotic for a septic patient based on their specific risk factors and the hospital’s antibiogram.

Your Journey Through the Model

As a new manager, you will likely spend most of your initial time in Levels 1 and 2, mastering your department’s descriptive and diagnostic data. This is essential—you cannot predict the future until you have a deep and accurate understanding of the past. The goal of this section is to equip you with the foundational knowledge of Level 3, allowing you to begin incorporating simple, powerful forecasting techniques into your operational planning. Mastery of Level 4 often requires dedicated data scientists and sophisticated tools, but understanding its potential will enable you to be an intelligent partner in more advanced, hospital-wide analytics initiatives.

17.3.3 Your Predictive Toolkit Part 1: Forecasting Fundamentals

Forecasting is the most accessible and immediately useful application of predictive analytics. It is the process of making predictions about the future based on past and present data, most commonly by analyzing trends. As a manager, you will constantly need to forecast: drug budgets, staffing needs, medication usage, and patient volumes. While perfect prediction is impossible, using formal forecasting methods can dramatically improve your accuracy and provide a data-driven rationale for your decisions. We will explore the most common and practical techniques you can begin using immediately.

The Foundation: Time Series Analysis

Most of the data you will forecast (drug usage, patient days, etc.) is time series data—a sequence of data points indexed in time order. To create a good forecast, you must first deconstruct the time series to understand its underlying components.

  • Trend: The long-term direction of the data. Is your overall drug spend generally increasing, decreasing, or staying flat over several years?
  • Seasonality: A predictable, repeating pattern that occurs over a known period (e.g., daily, weekly, yearly). The spike in RSV medication use every winter is a classic seasonal pattern.
  • Cyclicality: A pattern that repeats over longer, less predictable timeframes. For example, hospital census might fluctuate with broader economic cycles over many years.
  • Noise (or Random Variation): The unpredictable, irregular fluctuations in the data that are not explained by trend, seasonality, or cyclicality.
Method 1: Moving Averages (Smoothing Out the Noise)

The simplest forecasting method is the moving average. It works by taking the average of the last ‘n’ periods of data to forecast the next period. This is highly effective at smoothing out random noise to see the underlying trend.

Simple Moving Average (SMA): A 3-month SMA for September would be the average of June, July, and August. The formula is:

$$SMA_t = \frac{D_{t-1} + D_{t-2} + … + D_{t-n}}{n}$$

Where $D_t$ is the demand in period t, and n is the number of periods.

Weighted Moving Average (WMA): This is a more sophisticated version that gives more weight to more recent data, which is often more relevant. The formula is:

$$WMA_t = w_1 D_{t-1} + w_2 D_{t-2} + … + w_n D_{t-n}$$

Where the weights ($w_i$) must sum to 1.

Masterclass Example: Forecasting Albumin 25% Usage

You need to forecast the usage of Albumin 25% 100mL bottles for October. Here is your usage data for the past 6 months:

Month Usage (Bottles) 3-Month SMA Forecast 3-Month WMA Forecast (Weights: 0.5, 0.3, 0.2)
April210
May230
June225
July245(210+230+225)/3 = 221.7(0.5*225)+(0.3*230)+(0.2*210) = 223.5
August250(230+225+245)/3 = 233.3(0.5*245)+(0.3*225)+(0.2*230) = 236.0
September265(225+245+250)/3 = 240.0(0.5*250)+(0.3*245)+(0.2*225) = 243.5
October Forecast?(245+250+265)/3 = 253.3(0.5*265)+(0.3*250)+(0.2*245) = 256.5
Interpreting the Forecast

Notice that the WMA forecast is consistently higher and closer to the actual usage in the following month. This is because the usage shows a clear upward trend, and the WMA, by giving more weight to the most recent data, responds to this trend faster than the simple average. For your October forecast, the WMA of ~257 bottles is likely a more accurate prediction than the SMA of ~253 bottles. You can use this forecast to set your PAR levels and place your next order.

Method 2: Regression Analysis (Finding the Relationship)

While moving averages are good for simple, trend-based forecasting, regression analysis is a much more powerful tool that allows you to forecast a variable based on its relationship with one or more other variables. It is the workhorse of predictive analytics.

The goal of regression is to find the mathematical equation that best describes the data. For a simple linear regression (one predictor variable), the equation is the familiar:

$$Y = mX + b$$

Where Y is the variable you want to predict (the dependent variable), X is the predictor (the independent variable), m is the slope of the line, and b is the y-intercept.

Masterclass Example: Forecasting Total Drug Spend

You know intuitively that as your hospital gets busier, your drug spend increases. Regression allows you to quantify this relationship and build a predictive model. Your dependent variable (Y) is “Monthly Drug Spend.” Your independent variable (X) is “Monthly Adjusted Patient Days (APD).” You gather the data for the last 12 months.

When you plot this data in a scatter plot and run a linear regression (a standard feature in Excel), you get a result like this:

Monthly Drug Spend vs. Adjusted Patient Days

Regression Equation: Spend = 250.75 * (APD) + 550,000

R-squared: 0.92

Interpreting the Model

The Equation: You now have a powerful predictive formula. The finance department tells you they are projecting next month’s APD to be 8,000. You can now forecast your drug spend with data:
Forecasted Spend = 250.75 * (8000) + 550,000 = $2,006,000 + $550,000 = $2,556,000.
You can take this forecast to your budget meeting and provide a clear, data-driven rationale for your projected expenses.

The R-squared (R²): This value tells you how well your model fits the data. It represents the proportion of the variance in the dependent variable (Spend) that is predictable from the independent variable (APD). An R² of 0.92 is extremely high and means that 92% of the variation in your monthly drug spend can be explained by the variation in patient days. This gives you high confidence in your model’s predictions.

What if you want to make your model even more powerful? You can use Multiple Linear Regression to add more independent variables. For example, you might find that surgical volume is also a major driver of drug costs. Your new model might be:

$$\text{Spend} = b_0 + m_1(\text{APD}) + m_2(\text{Surgical Cases})$$

This allows you to create even more nuanced and accurate forecasts by accounting for multiple business drivers simultaneously.

Correlation is NOT Causation

This is one of the most important principles in all of statistics. Regression analysis is exceptional at identifying correlations—mathematical relationships between variables. However, it cannot, by itself, prove that one thing causes another. For example, you might find a strong correlation between ice cream sales and drowning deaths. This does not mean that eating ice cream causes people to drown. The hidden variable (or confounding variable) is the season: in the summer, both ice cream sales and swimming increase. As a manager, you must use your professional judgment to interpret the results of your models and not jump to erroneous conclusions about causality.

17.3.4 Your Predictive Toolkit Part 2: Classification and Optimization

While forecasting predicts a continuous value (like drug spend), another powerful branch of predictive analytics, called classification, predicts a categorical or binary outcome (e.g., Yes/No, High/Medium/Low). These models are used to classify individuals or events into groups, allowing you to target interventions with incredible precision. Beyond prediction, we will also introduce optimization, a prescriptive technique that doesn’t just predict the future but helps you find the best possible way to respond.

Classification Models: Answering “Will It Happen?”

A classification model analyzes a set of input variables (called “features”) to predict the probability that an event belongs to a certain class. This has transformative potential for proactive clinical pharmacy services and operational risk management.

Masterclass Example: Predicting 30-Day Hospital Readmissions

The Business Problem: Hospital readmissions are costly, harmful to patients, and heavily penalized by payers like CMS. Your hospital has tasked you with developing a program to reduce readmissions for patients with Congestive Heart Failure (CHF).

The Predictive Approach: Instead of providing the same level of intervention to all 200 CHF patients discharged each month, you want to use a classification model to identify the 20-30 patients who are at the highest risk of being readmitted. This allows you to focus your limited pharmacist resources where they will have the greatest impact.

Component Description
The Goal For every CHF patient being discharged, predict the probability that they will be readmitted to the hospital for any reason within 30 days.
The Model’s Output A risk score (e.g., 0-100) or a simple classification (High Risk / Low Risk).
The “Features” (Input Variables) You would work with a data analyst to extract historical data for thousands of past CHF patients. The model would learn the patterns from features like:
  • Demographics: Age, gender.
  • Clinical Data: LVEF (Left Ventricular Ejection Fraction), recent BNP lab value, creatinine clearance.
  • Comorbidities: Presence of diabetes, COPD, renal failure (from ICD-10 codes).
  • Utilization History: Number of ED visits in the last 6 months, number of prior hospital admissions.
  • Medication Data: Number of home medications (polypharmacy), use of high-risk drugs like opioids or anticoagulants, prescription for a loop diuretic at discharge.
The “Label” (Historical Outcome) For each patient in your historical dataset, you have a simple binary label: Was Readmitted in 30 Days (Yes/No)? The model learns the complex relationships between the features and this known outcome.
The Operational Intervention The model runs automatically on every CHF patient scheduled for discharge. If a patient’s risk score exceeds a certain threshold (e.g., >75%), an automated alert is sent to the Transitions of Care pharmacist. This triggers a mandatory, high-intensity intervention:
  • Bedside medication reconciliation and counseling.
  • A follow-up phone call 48 hours post-discharge.
  • Coordination with the patient’s outpatient pharmacy and cardiologist.
The Strategic Impact

This predictive approach transforms your transitions of care program from a blanket, low-intensity service to a targeted, high-intensity surgical strike. You apply your most valuable resource—your pharmacist’s time—to the patients who are statistically most likely to benefit, dramatically increasing the ROI of your program and having a measurable impact on a key hospital-wide metric.

Optimization: Finding the “Best” Possible Answer

Optimization is a form of prescriptive analytics. It takes prediction a step further. While a predictive model might forecast your staffing needs, an optimization model will tell you the single best staffing schedule to meet your goals. It uses mathematical algorithms to find the optimal solution from a vast number of possibilities, given a specific objective and a set of constraints.

Masterclass Example: Optimizing the Technician Work Schedule

The Business Problem: You need to create the weekly schedule for your 20 pharmacy technicians. You have multiple, competing goals: you want to minimize your labor cost, but you also need to ensure that medication turnaround times are met, that technicians get the shifts they prefer, and that all hospital and union rules are followed.

The Predictive/Prescriptive Approach: An optimization model can solve this incredibly complex puzzle in minutes.

Component Description
The Objective Function This is the goal you want to achieve, stated mathematically. Most commonly: Minimize Total Labor Cost.
The Decision Variables These are the things the model can change to achieve the objective. In this case, it’s a binary variable for each technician for every possible shift: Technician A works Shift 1 (Yes/No)? Technician A works Shift 2 (Yes/No)? …and so on for all techs and all shifts.
The Constraints These are the rules or limits that the final solution must obey. This is where you build in your operational reality:
  • Demand Constraints (from a predictive model): The number of technicians on duty during any given hour must be greater than or equal to the forecasted demand for that hour.
  • Rule Constraints: Each technician must be scheduled for exactly 40 hours per week; each technician must have at least two consecutive days off; a technician cannot be scheduled for a day shift immediately following a night shift.
  • Service Level Constraints: The resulting schedule must lead to a predicted average STAT turnaround time of less than 15 minutes (based on a simulation).
  • Preference Constraints (soft constraints): The model can be designed to try and honor as many technician shift preferences as possible, adding a “satisfaction” component.
The Optimized Output The model sifts through millions of possible schedule combinations and provides the single, mathematically optimal schedule that satisfies all constraints while achieving the lowest possible labor cost. It is a perfect, data-driven solution to a complex logistical problem.

17.3.5 Practical Implementation: The Data You Need and How to Get It

The sophisticated models described in this section are powerful, but they share a common, unyielding requirement: they are hungry for data. The quality, granularity, and accessibility of your data are the ultimate limiting factors in your ability to leverage predictive analytics. The “Garbage In, Garbage Out” principle we’ve discussed before applies with even greater force here; a predictive model trained on flawed, incomplete, or biased data will produce flawed, incomplete, or biased predictions. A key part of your role as a data-driven leader is to understand the data ingredients required for your desired analytical outcomes and to champion the initiatives needed to capture and organize that data effectively.

Masterclass Table: Predictive Model Data Ingredients

This table outlines the data requirements for the predictive models we have discussed. It is designed to help you understand the types of data you will need to start collecting and organizing to enable these advanced capabilities.

Predictive Goal Key Data Sources Required Specific Data Elements (“Features”) Needed Common Hurdles & How to Overcome Them
Forecast Monthly Spend for a High-Cost Drug (e.g., IVIG)
  • PIS / Wholesaler Purchasing History
  • EHR Medication Administration Record (MAR)
  • ADT (Admit-Discharge-Transfer) System
  • Historical purchase dates and quantities
  • Historical administration dates and doses
  • Historical patient census / patient days
  • (Advanced) Number of patients with specific ICD-10 codes (e.g., primary immunodeficiency)
Hurdle: Distinguishing between usage (administrations) and purchases. A large purchase in one month can skew the data.
Solution: Base your forecast on the MAR administration data, as it is a truer reflection of patient demand. Use purchasing data to validate your model.
Predict Patient Risk of 30-Day Readmission
  • EHR Clinical Data Repository
  • ADT System
  • Pharmacy Information System (PIS)
  • Patient demographics (age)
  • Diagnosis codes (ICD-10) for comorbidities
  • Lab values (e.g., BNP, SCr)
  • Prior utilization (ED visits, admissions in last 6 months)
  • Number of discharge medications
Hurdle: Data lives in multiple, separate systems.
Solution: This project requires a strong partnership with your IT/data analytics department. They will need to create a unified, patient-level dataset (often called a data warehouse or data mart) that brings together clinical, demographic, and pharmacy data.
Optimize Technician Staffing Schedule
  • Time-stamped data from PIS and EHR
  • Employee timeclock/scheduling system
  • ADT System
  • Hourly counts of new orders, verified orders, dispensed doses (from ADCs, carousels), and IVs compounded.
  • Historical technician clock-in/clock-out data.
  • Historical patient census by nursing unit.
  • Technician skill mix (e.g., certified IV tech vs. general tech).
Hurdle: Capturing granular, time-stamped workload data can be difficult.
Solution: Leverage the data that is already being captured. Your PIS and ADC systems log the exact time of every transaction. Work with your vendors or IT to get access to these raw transaction logs, which are a goldmine of workload data.
Start Small, Start Now

The scale of these projects can feel intimidating. Do not let that stop you. The journey to predictive analytics begins with a single, well-defined, and achievable project. Start with the most accessible technique: forecasting. Pick one high-cost, variable-use drug that consistently gives you budget headaches. Gather 2-3 years of monthly administration data from your systems and put it into an Excel spreadsheet. Use the simple moving average and regression tools built into Excel to create your first data-driven forecast.

When you go to your next budget meeting and present a simple line chart and a regression equation to justify your requested budget for that drug, you will have taken the first and most important step. A successful small project is the single best way to demonstrate the value of analytics and build the momentum and buy-in you will need for more advanced initiatives in the future.