My work here is simply limited to replicating the efforts of José
Carlos Soage González and Andrew Heiss (Soage
González and Heiss 2020). Utilizing their econocharts
package and Andrew Heiss’s reconPlots
package, I was able to recreate supply and demand curve visuals in R
with only minor modifications to accommodate recent updates. Their
contributions have been instrumental in enabling these
visualizations.
This is an analysis of one of the five supply and demand curves we’ll examine. In this case, both the supply and demand curves have typical slopes—not too steep or too flat—indicating an average level of elasticity. The equations for these curves are as follows:
\[ S:P = 2 + 0.25Q \] \[ D:P = 20−0.5𝑄 \] \[ S_{\text{tax}}:𝑃=2+0.25𝑄+5 \]
library(econocharts)
library(ggplot2)
library(dplyr)
# Data
demand <- function(Q) 20 - 0.5 * Q
supply <- function(Q) 2 + 0.25 * Q
supply_tax <- function(Q) supply(Q) + 5
# Chart
tax_graph(demand, supply, supply_tax, title = "Supply and demand with regular elasticity")[1]
## $p
# Chart with shaded areas
tax_graph(demand, supply, supply_tax, shaded = TRUE)[1]
## $p
In this case, demand is highly elastic, meaning that consumers adjust their consumption of the good rapidly in response to price changes (for example, a price increase quickly drives people away from buying it). As a result, the tax burden primarily falls on producers, who are unable to avoid it. The high elasticity also leads to a significant deadweight loss (DWL) due to the tax.
\[ S:P = 2 + 0.25Q \]
\[ D:P = 10−0.05𝑄 \]
\[ S_{\text{tax}}:𝑃=2+0.25𝑄+5 \]
# Data
demand <- function(Q) 10 - 0.05 * Q
supply <- function(Q) 2 + 0.25 * Q
supply_tax <- function(Q) supply(Q) + 5
# Chart
tax_graph(demand, supply, supply_tax, title = "Elastic demand")[1]
## $p
# Chart with shaded areas
tax_graph(demand, supply, supply_tax, shaded = TRUE)[1]
## $p
In this scenario, demand is highly inelastic—changes in price lead to only small changes in quantity (i.e., when the price goes up, only a few people stop buying, while those who continue to purchase have to bear the higher cost). As a result, the tax burden primarily falls on consumers, who cannot avoid it. Additionally, due to the low elasticity, the tax creates a smaller deadweight loss.
\[ S:P = 2 + 0.25Q \]
\[ D:P = 20−2𝑄 \]
\[ S_{\text{tax}}:𝑃=2+0.25𝑄+5 \]
# Data
demand <- function(Q) 20 - 2 * Q
supply <- function(Q) 2 + 0.25 * Q
supply_tax <- function(Q) supply(Q) + 5
# Chart
tax_graph(demand, supply, supply_tax, title = "Inelastic demand")[1]
## $p
# Chart with shaded areas
tax_graph(demand, supply, supply_tax, shaded = TRUE)[1]
## $p
In this scenario, the supply is highly elastic, meaning that even a small change in price leads to a significant change in the quantity supplied. For example, if a tax on books were increased, a company like Amazon could easily shift its focus to music, video, or web services, with minimal impact on its overall business. As a result, the tax burden primarily falls on consumers, as the company can avoid the tax more easily. The high elasticity also results in a substantial deadweight loss due to the tax.
\[ S:P = 2 + 0.05Q \]
\[ D:P = 20−0.5𝑄 \]
\[ S_{\text{tax}}:𝑃=2+0.05𝑄+5 \]
# Data
demand <- function(Q) 20 - 0.5 * Q
supply <- function(Q) 2 + 0.05 * Q
supply_tax <- function(Q) supply(Q) + 5
# Chart
tax_graph(demand, supply, supply_tax, title = "Elastic supply")[1]
## $p
# Chart with shaded areas
tax_graph(demand, supply, supply_tax, shaded = TRUE)[1]
## $p
In this case, the supply is highly inelastic—meaning that as the price changes, the quantity produced changes only slightly. For instance, increasing a tax on books would heavily impact a small family-owned bookstore that exclusively sells books, as they have no alternative products to switch to. Consequently, the tax burden falls mainly on the producers, as the business cannot avoid the tax by shifting to other activities.
\[ S:P = 2 + 1.5Q \]
\[ D:P = 20−0.5𝑄 \]
\[ S_{\text{tax}}:𝑃=2+1.5𝑄+5 \]
# Data
demand <- function(Q) 20 - 0.5 * Q
supply <- function(Q) 2 + 1.5 * Q
supply_tax <- function(Q) supply(Q) + 5
# Chart
tax_graph(demand, supply, supply_tax, title = "Inelastic supply")[1]
## $p
# Chart with shaded areas
tax_graph(demand, supply, supply_tax, shaded = TRUE)[1]
## $p