Predictive performance
You can use your model to make predictions for any chosen price level. Obtaining reasonable predictions is dependent on the correctness of your assumption that volume sales and unit price are linearly related.
You will display the relation between SALES
and PRICE
in a simple scatterplot by using the function plot()
. Just like the lm()
function, the plot()
function can also operate on the formula argument SALES ~ PRICE
, and will create the required graph. Next, you add the model predictions by using the function abline()
, which adds a straight line specified in sales intercept/price slope form when applied to the linear.model
object.
Diese Übung ist Teil des Kurses
Building Response Models in R
Anleitung zur Übung
- Display the relation between
SALES
andPRICE
by using the functionplot()
. - Again, explain
SALES
byPRICE
and assign the result to an object namedlinear.model
. - Add the model predictions by applying the function
abline()
to thelinear.model
object.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Plot SALES against PRICE
___(___ ~ ___, data = sales.data)
# Explain SALES by PRICE
linear.model <- ___(___ ~ ___, data = sales.data)
# Add the model predictions
___(___)