\[R(Q) = 5,000Q - 25Q^{2} \] Use the provided quad function to find the roots, the quantity that maximizes revenue, and the maximum revenue.
QUAD <- function(a,b,c) {
possol <- (-b+sqrt(b^2-4*a*c))/(2*a)
negsol <- (-b-sqrt(b^2-4*a*c))/(2*a)
vertex <- -b/(2*a)
optval <- a*(vertex^2) + b*vertex + c
print(paste0("Positive Root = ",possol))
print(paste0("Negative Root = ", negsol))
print(paste0("Vertex = ",vertex))
print(paste0("Max Value = ",optval))
}
## 5000Q - 25Q^2
QUAD(-25,5000,0)
## [1] "Positive Root = 0"
## [1] "Negative Root = 200"
## [1] "Vertex = 100"
## [1] "Max Value = 250000"
\[ C(Q) = 1000Q + 400\]
Find an expression for profits for the firm (Hint: \(\pi = R(Q) - C(Q)\)) and determine the break-even quantities,the quantity level when profits are maximized, and the value of profits at the maximum. Use the QUAD function to solve for these values.
\[ -25Q^{2} + 4000Q - 400\]
# Fill in the values for a,b, and c for your expression for profits in the line below here.
# Profit = aQ^2 + bQ + c
QUAD(-25,4000,-400)
## [1] "Positive Root = 0.10006257824728"
## [1] "Negative Root = 159.899937421753"
## [1] "Vertex = 80"
## [1] "Max Value = 159600"
#Plot profits
q <- seq(from = 0, to = 160, by = 5)
profit <- -25*q^2 + 4000*q - 400
plot(profit ~ q, type = "l")
No. Revenues don’t take into account costs. Profits are most likely not maixmized where revenue is maximized.
stock <- read.table("https://raw.githubusercontent.com/tjdevine/EC255/refs/heads/main/stock_returns.txt",header=TRUE)
names(stock)
## [1] "SP500_RET" "AAPL_RET"
trend <- lm(AAPL_RET ~ SP500_RET, data = stock)
plot(AAPL_RET ~ SP500_RET, data = stock)
abline(trend, col = "red")
trend
##
## Call:
## lm(formula = AAPL_RET ~ SP500_RET, data = stock)
##
## Coefficients:
## (Intercept) SP500_RET
## 0.007007 1.354915