(This article was first published on

**Econometrics by Simulation**, and kindly contributed to R-bloggers)# A single price monopolist is a monopolist because it is the only supplier of a particular product. The monopolist therefore has the power to choose a price to sell the product at.

# Those who have a willingness to pay which is greater than the price will buy the good while those who have a willingness to pay for the good which is less than the chosen price will not but it.

# Our monopolist is a broadband internet supplier within a city.

# For now let's say they only offer one bundle.

# Let's generate our consumers

npeep <- 2000 # Number of potential consumers

wtp <- 45 + rnorm(npeep)*15 # Each person has a different willingness to pay which

# To figure out the demand curve we count the number of people willing to pay at least as much as the offering price.

maxop <- 90 # Max offering price

op <- 0:maxop # Offering price ranges from 0 to maxop

qd <- rep(NA,length(op)) # Quantity demanded

for (i in 1:length(op)) qd[i] <- sum(wtp>=op[i])

mc <- qd*.01 # Marginal cost is increasing though this is not a neccessity

# For something like broadband services we might think that up to a point marginal costs might be decreasing since the cost of adding one more customer might be less than the cost of adding the previous customer.

plot(qd, op, type="l", xlab="Quantity", ylab="Price, Marginal Cost - Red",

main="Demand for Broadband Internet", lwd=2)

abline(h=0, lwd=2)

lines(qd, mc, col="red", lwd=2)

# The monopolist must choose a price in which to sell services at.

# If the monopolist chooses mc=p then the monopolist will not make any money but the consumers will be very happy.

# We know that the optimal point for the monopolist is at the point where marginal revenue curve intersects the marginal cost curve.

# Let's see if we can find it.

tr <- tp <- tc <- rep(NA,length(op)) # Total revenue, total profit, total cost vectors

# Calculate total cost

qd.gain <- qd[-length(qd)]-qd[-1]

qd.gain[length(qd.gain)+1] <- qd.gain[length(qd.gain)]

for (i in 1:length(op)) tc[i] <- sum((mc*qd.gain)[length(qd):i])

tr <- qd*op

tp <- tr-tc

minmax <- function(...) c(min(...),max(...))

plot(minmax(op),minmax(tr,tp), type="n", ylab="Total Revenue - Blue, Total Profit - Red",

xlab="Price", main="We can see optimal pricing\nfor the monopolist is around 39 dollars")

grid()

abline(h=0, lwd=2)

abline(v=39, col="red", lwd=2)

lines(op,tr, col="blue", lwd=3)

lines(op,tp, col="red", lwd=2)

# We can see at the price around 18 which would be the optimal price for the consumer, the supplier is making almost no profits.

# The last thing we might wish to consider to Total Surplus or total system efficiency which is defined as that which the consumer benefits by purchasing a good below the consumers willingness to pay plus that of the suppliers profit at that price.

cs <- tr

for (i in 1:length(op)) cs[i] <- sum((wtp[wtp>=op[i]]-op[i]))

tts <- cs+tp

op[tts==max(tts)] # Check the optimatal societal price

plot(c(min(op),max(op)),c(min(cs,tp),max(cs,tp)), type="n",

main="Optimal societal pricing is at\n mc=wtp which is $19",

xlab="Price",

ylab="purple=CS, blue=PS, black=TS")

lines(op, cs, col="purple", lwd=2)

lines(op, tp, col="blue", lwd=2)

lines(op, tts, lwd=2)

abline(h=0,col="red", lwd=2)

Formatted by Pretty R at inside-R.org

To

**leave a comment**for the author, please follow the link and comment on their blog:**Econometrics by Simulation**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...