Microeconomics

Pharmacist labor market using supply and demand curves

Introduction

Pharmacists are specialized health professionals with a Doctor of Pharmacy (PharmD) degree. Pharmacists are generally viewed as medication dispensing specialist, but they also monitor for potential drug-drug interactions, provide vaccinations, manage therapy for patients with chronic disease, and in some states, provide and deliver healthcare directly to patients. As the role of the pharmacist expands, the demand also has increased.

There has been a lot of research to understand the pharmacist labor market. In the early 2000s, reports indicated that there was a pharmacist shortage, which was fueled by the growing number of the senior citizen population and increased number of prescriptions.[1–3] This concern of a pharmacist labor market shortage, which was unable to meet the demand of a growing Medicare population, led to an increase in the number of Doctor of Pharmacy Schools in the United States from 80 in 2000 to approximately 140 in 2020.[4]

However, pharmacy school enrollment has been dwindling, which threatens the labor market supply. For instance, the number of applications to pharmacy schools dropped by 36% from 2012 to 2021.[5] This has led to some pharmacy school closures in recent years.[6,7] Further, the California Board of Pharmacy reported staffing levels at community pharmacies were dangerously low and could threaten patient care and safety.[8]

Microeconomic theory can provide some insights into the evolving pharmacy labor market. By using simple supply and demand curves, we can illustrate how these factors can impact the wages and quantity of pharmacists in the labor market.

Supply and Demand

The pharmacist labor market can be explained by the demand needed for their services and the number of available pharmacists in the workforce. It can also be explained by the supply of pharmacists currently in the market or entering the market.

Demand can be due to the expanding role of the pharmacist to provide innovative healthcare to their community, the growing senior citizen population, and the rise in prescriptions ordered and dispensed. Demand for pharmacist can also increase due to their evolving roles as practitioners.  

Likewise, the supply of pharmacists in the workforce will depend on several factors such the number of new pharmacists entering the market (e.g., pharmacy school graduates) and the current supply that are already in the workforce. The supply of pharmacists will also be impacted by the number who retire or burnout and pursue other activities such as administrative roles.

We can use simple supply and demand curves to illustrate how the market (e.g., wages and quantity) can be impacted by things like a decrease in the enrollment and graduation of pharmacy students, the shrinking number of pharmacists due to retirement or leaving the workforce due to burnout, evolving role of pharmacists, and the increased number of senior citizens enrolled in Medicare.

Wages are important because this can incentive individuals to pursue a pharmacist career. If the wage is high enough, they are incentivized to enroll into a pharmacy school and become a pharmacist. However, if the wages are too low, then individuals are less likely to pursue a career in pharmacy. Likewise, firms will need to pay higher wages for pharmacists if there is a shortage and high demand for them in the market.

 

Simple example

In this simple illustration, the supply and demand curves are plotted along the wage (W) and quantity (Q) axes (Figure 1).

Figure 1. Simple demand and supply curves.

We can think of there being two players in this pharmacist labor market: Firms (employers) and pharmacists (employees). Pharmacies (e.g., firms/employers) have a need to hire pharmacist to deliver healthcare services, and pharmacists (employees) have a need for pharmacies to hire their labor. The demand and supply curves provide a visual approach to determine the ideal wage and quantity of pharmacists in the market.

The supply curve is upward sloping. As the wage of the pharmacist increases, there is an incentive to increase the quantity of pharmacists in the market. Individuals will go to pharmacy school and complete their training to become pharmacists. Likewise, pharmacy schools may increase enrollment or new pharmacy schools may open to meet the demand.

The demand curve is downward sloping. As the wage of the pharmacist decreases, there is very little to no incentive to become a pharmacist, thus, the quantity of pharmacists decreases. Conversely, if there is a high demand for pharmacists, then the firms will pay a higher wage in order to incentivize individuals to enter the pharmacist workforce.

The point where the supply and demand curves intersect is the equilibrium point. This is where the equilibrium wage (W*) and the equilibrium quantity (Q*) are determined. At the equilibrium wage W*, there should be an equilibrium quantity (Q*) of pharmacists in the labor market.

There are several assumptions we have to make with this simple example. First, this is a perfectly competitive market. This means that there are many firms or employers who will hire pharmacists. Second, market forces determine the wages in the pharmacist labor market. This means that pharmacists (employees) and firms (employers) are wage takes (not wage setters). Lastly, there is perfect information in the sense that both the firm and pharmacist know what the wages and quantity needed are or should be in the market.

With those things in place, we can see how the market can impact the wages and quantity of pharmacists in the workforce.

 

Factors that affect supply

It’s clear that the supply of pharmacists in the market will depend on the number of graduates and the current rate of pharmacist who retire. But there are other factors that can impact the supply of pharmacist in the labor market. For instance, pharmacists may work part-time thereby reducing the number of available pharmacists for the workforce. Pharmacists may also take on other non-patient care roles such as administration. Low enrollment and school closures can also affect the quantity of pharmacist in the market. Further, increased student debt may dis-incentivize individuals to pursue a career as a pharmacist.

When these factors occur, there is a shift in the supply curve to the left (Figure 2). This shift (S -> S') changes the equilibrium wage (W*) and quantity (Q*) of pharmacists to be higher and lower, respectively. As the supply of pharmacists in the labor market decreases, then the market will respond by setting a higher wage (W') but at a lower quantity (Q') of pharmacists. Alternatively, firms are willing to pay a higher wage for pharmacists due to a decrease in the labor supply.

Figure 2. Supply curve shifts to the left due to a shortage.

Conversely, there could a surplus of pharmacists in the workforce, which means that there are so many pharmacists that firms don’t need them. Alternatively, the large quantity of pharmacists shifts the supply curve to the right (S -> S''). This is illustrated in Figure 3. When the supply curve shifts to the right, the wage of the pharmacist becomes lower (W'') at the new quantity of pharmacists (Q'') that are hired by the firm. Having a lot of pharmacists is good for the firms since they can hire more at a lower wage. But this will disincentive individuals from pursuing a career in pharmacy.

Figure 3. Supply curve shifts to the right due to a surplus.

Factors that affect demand

But what about the factors that affect the demand of pharmacists in the workforce? How will that impact the wage and quantity?

Let’s consider a scenario where the senior citizen population is increasing and there is a need for pharmacists to educate them on their medications. Pharmacies are expecting a large number of Medicare Patients to also enroll in their Medication Therapy Management (MTM) plans where the pharmacist will be their main healthcare contact and provider. The expanding role of pharmacists and the increasing number of patients both contribute to the demand of pharmacists. This has an impact of the demand curve and shifts this to the right, D -> D'. Figure 4 illustrates the shift in the demand curve to the right where the wage of the pharmacist has increased to W' and the quantity hired has increased to Q'. In other words, firms are paying higher wages for pharmacist to fill critical roles in their pharmacies, which results in more pharmacists being hired to meet the increase in demand.

Figure 4. Demand curve shifts to the right due to an increase in the demand for pharmacists.

However, the demand or need for pharmacists can decrease due to market forces. The evolution of artificial intelligence and robotics may decrease the demand of pharmacists. Should this scenario occur, the demand for pharmacists will decrease, which is represented by a shift in the demand curve to the left (D -> D''). Figure 5 illustrates the impact that a decrease in the demand curve will have on the wage and quantity of the pharmacist in the workforce. As the demand curve shifts to the left, the wage (W'') is lower and the quantity (Q'') of pharmacists is also lower. This means that firms are going to hire less pharmacists at a lower wage due to a decrease in the demand.

Figure 5. Demand curve shifts to the left due to a decrease in the demand for pharmacists.

Simultaneous shifts in the supply and demand

So far, we only looked at the effects that supply and demand would have on the pharmacy labor market independently of each other. But what is both the supply and demand are affected at the same time? What would happen to the pharmacy labor market in terms of wages and quantity hired?

Let’s consider a scenario where there is a shortage of pharmacists in the labor market, but the demand has increased due to an increasing number of senior citizens enrolled in Medicare (Figure 6). This would cause the supply curve to shift to the left (S -> S''') and the demand curve to shift to the right (D -> D'''). This would result in firms hiring more pharmacists (Q''') at a higher wage (W''').

Figure 6 illustrates what would have if there was a shortage of pharmacists and the demand increased.

We can consider the opposite effect where the demand of pharmacists decreases (or shifts to the left) and the supply increases (or shifts to the right). This would result in a depression in wages and a small increase in the quantity of pharmacists being hired (Figure 7). Firms will hire slightly more pharmacists at depressed wages due to a simultaneous decrease in demand and an increase in the supply of pharmacists in the workforce. I think of this as a worst-case scenario for the pharmacist profession.

Figure 7. Impact of decreased demand and increased supply of pharmacists in the workforce.

Conclusions

Using simple illustrations of the supply and demand curves, we can visualize how the market would react to changes in the demand and supply of pharmacists in the workforce. We have to assume that the pharmacist labor market is in perfect competition. However, in the real-world, that doesn’t always occur. For example, studies have evaluated the impact of consolidation of (large retail chain) pharmacies that could control the market and force pharmacists to accept the wages they offer (monopsony).[9,10] This can violate the assumption of a pharmacist labor market being in perfect competition and seriously disadvantage pharmacists from not being able to negotiate fair wages. Regardless, by using these simple methods, we can start to understand how markets should behave in ideal conditions and when to identify when these markets are failing us, thereby requiring some policy intervention to make things more fair.

 

References

1. Knapp KK, Quist RM, Walton SM, Miller LM. Update on the pharmacist shortage: national and state data through 2003. Am J Health Syst Pharm. 2005;62(5):492-499. doi:10.1093/ajhp/62.5.492

2. Knapp KK, Livesey JC. The Aggregate Demand Index: measuring the balance between pharmacist supply and demand, 1999-2001. J Am Pharm Assoc (Wash). 2002;42(3):391-398. doi:10.1331/108658002763316806

3. Taylor TN, Knapp KK, Barnett MJ, Shah BM, Miller L. Factors affecting the unmet demand for pharmacists: state-level analysis. J Am Pharm Assoc (2003). 2013;53(4):373-381. doi:10.1331/JAPhA.2013.12130

4. Brown DL. Years of Rampant Expansion Have Imposed Darwinian Survival-of-the-Fittest Conditions on US Pharmacy Schools. Am J Pharm Educ. 2020;84(10):ajpe8136. doi:10.5688/ajpe8136

5. Pharmacy College Application Service. 2021-2022 - PharmCAS Applicant Data Report. Accessed December 17, 2023. https://connect.aacp.org/discussion/pharmcas-applicant-data-for-2021-2022

6. Harsa C. Husson University to close its pharmacy school. newscentermaine.com. February 17, 2025. Accessed June 22, 2025. https://www.newscentermaine.com/article/news/education/husson-university-pharmacy-school-program-university-of-new-england-students-maine/97-665e64a5-ecb9-44ea-a1ed-187e6fb495a7

7. American Association of Colleges of Pharmacy. Pharmacy Schools Are Essential to Meeting Growing Demand for Pharmacists’ Services. Accessed June 22, 2025. https://www.aacp.org/article/pharmacy-schools-are-essential-meeting-growing-demand-pharmacists-services

8. California Board of Pharmacy. Pharmacy Workforce Survey, 2021. California Board of Pharmacy; 2021. Accessed December 18, 2023. https://www.pharmacy.ca.gov/meetings/agendas/2021/workforce_presentation.pdf

9. Farag E, Steinbaum M. A Retrospective Analysis of the Acquisition of Target’s Pharmacy Business by CVS Health: Labor Market Perspective. Published online November 25, 2023. doi:10.2139/ssrn.4644895

10. Bounthavong M. Despair and hope: Is the retail community pharmacy workforce in danger of becoming a monopsony labor market? J Am Pharm Assoc (2003). 2024;64(3):102039. doi:10.1016/j.japh.2024.02.012

Two-part models in R - Application with cost data

I created a tutorial on how to use two-part models in R for cost data. I used the healthcare expenditures from the Medical Expenditure Panel Survey in 2017 as a motivating example. Normally, I use Stata when I construct two-part models. But I wanted to learn how I could do this in R. Fortunately, R has a package called twopartm that was developed by Duan and colleagues. You can find their document for the twopartm package here.

The tutorial I created is located on my GitHub page and RPubs page.

Cobb-Douglas production function and costs minimization problem

Update 2: This article was updated on 12 August 2023 when Dimanjan Dahal (Twitter account) identified a better way to present the Lagrangian functions. I updated this to better reflect the minimization problem and set the partial derivative solution to 0. Thank you, Dimanhan.

Update 1: This article was updated on 11 October 2021 when an anonymous reader identified an error with the example used at the end. The error was the negative value generated for the output elasticity of capital. In the previous example, I used R to generate a set of random numbers that were used in a regression model. The beta coefficient generated a negative value which was used in the linear form of the Cobb-Douglass equation. Since the output of elasticity should be between the values of 0 and 1, this negative coefficient should not be possible. Hence, I’ve updated the data frame used in the example to avoid this issue. Appreciation goes out to the anonymous reader who identified this error.

INTRODUCTION

The Cobb-Douglas (CD) production function is an economic production function with two or more variables (inputs) that describes the output of a firm. Typical inputs include labor (L) and capital (K). It is similarly used to describe utility maximization through the following function [U(x)]. However, in this example, we will learn how to answer a minimization problem subject to (s.t.) the CD production function as a constraint.

The functional form of the CD production function:

 
Figure1.png
 

where the output Y is a function of labor (L) and capital (K), A is the total factor productivity and is otherwise a constant, L denotes labor, K denotes capital, alpha represents the output elasticity of labor, beta represents the output elasticity of capital, and (alpha + beta = 1) represents the constant returns to scale (CRS). The partial derivative of the CD function with respect to (w.r.t) labor (L) is:

 
Figure2.png
 

Recall that quantity produced is based on the labor and capital; therefore, we can solve for alpha:

 
Figure3.png
 

This will yield the marginal product of labor (L). If alpha = 2, then a 10% increase in labor (L) will result in a 20% increase in output (Y).

The partial derivative of the CD function with respect to (w.r.t) labor (K) is:

 
Figure4.png
 

This will yield the marginal product of capital (K).

The CD production function can be converted to a linear model by taking the logarithm of both sides of the equation:

 
Figure5.png
 

This will allow for OLS regression methods, which is commonly used in economics to understand the association between inputs (L and K) on production (Y).

However, what happens when we are interested in the marginal cost with respect to (w.r.t.) production (Y)? This becomes a constraint (cost) minimization problem where the firm can control how much L and K they will use. In other words, we want to minimize the cost subject to (s.t.) the output

 
Figure6.png
 

Cost becomes a function of wage (w), the amount of labor (L), price of capital (r), and the amount of capital (K). To determine the optimal amount of inputs (L and K), we solve this minimization constraint using the Lagrange multiplier method:

 
 

Solve for L

 
Figure8.png
 

Substitute L in the constraint term (CD production function) in order to solve for K

 
Figure9.png
 

Now, we can completely solve for L (as a function of Y, A, w, and r) by substituting for K

 
Figure10.png
 

Substitute L and K into the cost minimization problem

 
Figure11.png
 

Simplify

 
Figure12.png
 

Final cost function

 
Figure13.png
 

Let’s see how we can use the results from a regression model to give us information about the total costs w.r.t. to the quantity produced.

Recall the linear form of the Cobb-Douglas production function:

 
Figure14.png
 

I simulated some data where we have the capital, labor, and quantity produced in R.

## Use the following libraries: library(jtools) library(broom) library(ggstance) library(broom.mixed) ## Generate random data for the data frame (cddata) set.seed(1234) production <- sample(100:600, 30, replace=TRUE) labor <- sample(50:350, 30, replace=TRUE) capital <- sample(6000:7000, 30, replace=TRUE) ## Cost function parameters: wage and price constants wage <- 35.00 price <- 30.00 ## Set up the data frame (cddata): cddata <- data.frame(production = production, labor = labor, capital = capital, wage = wage, price = price) ## Name rows using some timeline from 1988 to 2017 (30 years for 30 observations for each variable): row.names(cddata) <- 1988:2017

Then I perform a regression model using OLS

## Setting up the model, where log(a) is eliminated due to it being the intercept. cd.lm <- lm(formula = log(production) ~ log(labor) + log(capital), data = cddata) summary(cd.lm) Residuals: Min 1Q Median 3Q Max -0.96586 -0.25176 0.06148 0.37513 0.67433 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 4.44637 17.41733 0.255 0.800 log(labor) 0.14373 0.23595 0.609 0.548 log(capital) 0.05581 2.00672 0.028 0.978 Residual standard error: 0.5065 on 27 degrees of freedom Multiple R-squared: 0.01414, Adjusted R-squared: -0.05888 F-statistic: 0.1937 on 2 and 27 DF, p-value: 0.8251

After running the model, I stored the coefficients for use later in the production function.

## Store the coefficients
coeff <- coef(cd.lm)

## Assign the values to the production function parameters where Y = AL^(alpha)K^(beta)
intercept <- coeff[1]
alpha <- coeff[2]
beta <- coeff[3]

From the parameters, we can get A (intercept), alpha (log(labor)), and beta (log(capital)).

 
linear form of CD function.jpg
 

This will give us the quantity produced (Y) for given data on labor (L) and capital (K).

We can get the total costs (C) based on the quantity produced (Y) using the cost function:

 
Figure16.png
 

I set up my R code so that I have the intercept, alpha, beta, labor, wage, and price of the capital set up. I estimated each part of the cost function separately and then multiply the parts at the end.

## Cost
PartA <- (production / intercept)^(1 / alpha + beta)
PartB <- wage^(alpha / alpha + beta)
PartC <- price^(beta / alpha + beta)
PartD <- as.complex(alpha / beta )^(beta / alpha + beta) + as.complex(beta/ alpha)^(alpha / alpha + beta)

costs <- PartA * PartB * PartC * PartD
Note: R has a problem with performing complex operations with exponents that were defined using arrays or vectors. If you try to compute something like x^{alpha}, you will get an error where the value is “NaN.” I don’t have a complete understanding of the problem, but the solution is to make sure your root or base term is preceded by “as.complex(x)” to resolve the issue.

I plot the relationship between quantity produced and cost. In other words, this tells us the lowest costs needed to produce the quantities on the plot.

plot(production, costs)
 
cost production curve.jpg
 

CONCLUSIONS

Using the Cobb-Douglas production function and the cost minimization approach, we were able to find the optimal conditions for the cost function and plot the outcome relative to the quantity produced. As production increases, the minimum cost needed increases in a non-linear, exponential fashion, which makes sense given that Y (quantity produced) is in the numerator on the right-hand side of the cost function and positively related to the cost.

This was a fun exercise that made me think about the usefulness of the Cobb-Douglas production function, which I learned to optimize multiple times in my Economics courses. I was excited to find a pleasant utility for it using simulated data and will probably explore more exercises like this in the future.

REFERENCEs

I used a lot of resources to write this blog, which are provided below.

A site dedicated to the discussion of economics called EconomicsDiscussion.net was a great resource.

These papers were incredibly helpful in preparing the example in R:

  • Lin CP. The application of Cobb-Douglas production cost functions to construction firms in Japan and Taiwan. Review of Pacific Basin Financial Markets and Policies Vol. 5, No. 1 (2002): 111–128.

  • Larriviere JB, Sandler R. A student friendly illustration and project: empirical testing of the Cobb-Douglas production function using major league baseball. Journal of Economics and Economic Education Research, Volume 13, Number 3, 2012: 81-92

  • Hu, ZH. Reliable Optimal Production Control with Cobb-Douglas Model. Reliable Computing. 1998; 4(1): 63-69.

I encountered some issues regarding complex numbers in R. Fortunately, I found some great resources about it.

  • I found a great discussion about R’s calculation of exponents and “NaN” results and why complex numbers can mess up your math in R.

  • Another good site (R Tutorial: An Introduction to Statistics) explaining complex numbers in R.

  • John Myles White wrote a nice article about complex numbers in R.

Acknowledgements: I would like to thank the user who reached out to me about the coefficient errors for the output elasticity of capital. This helps me to learn my mistakes and correct them. Without the support and guidance from the community, I would not achieve my own goals of being a lifelong learner. Thank you.