Plot P/B vs. ROE
Now that you have calculated the ROE and P/B multiples for the midcap Consumer Discretionary firms, we can now plot the P/B multiple (y-axis) vs. ROE (x-axis). We then add a trendline to the plot to visually demonstrate the trend, if any, between the two variables. The data for roe
and p_bv
are in the cons_disc
dataset.
This exercise is part of the course
Equity Valuation in R
Exercise instructions
- Set the x-axis range to make sure the entire range of ROE values are covered using
min()
andmax()
. - Set the y-axis range to make sure the entire range of P/B values are covered using
min()
andmax()
. - Plot the P/B vs. ROE data and label the x-axis "Return on Equity" and y-axis "Price-to-Book".
- Add a trendline using the regression model using
abline()
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Set x-axis range
x.range <- c(___(cons_disc$roe),
___(cons_disc$roe))
# Set y-axis range
y.range <- c(___(cons_disc$p_bv),
___(cons_disc$p_bv))
# Plot data
plot(y = ___,
x = ___,
xlab = "___",
ylab = "___",
xlim = x.range,
ylim = y.range,
col = "blue",
main = "Price-to-Book Value and Return on Equity
Of Mid-Cap Consumer Discretionary Firms")
# Regress roe on p_bv
reg <- lm(p_bv ~ roe, data = cons_disc)
# Add trend line in red
___(___, col = "red")