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.
Este ejercicio forma parte del curso
Building Response Models in R
Instrucciones del ejercicio
- 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.
Ejercicio interactivo práctico
Prueba este ejercicio completando el código de muestra.
# Plot SALES against PRICE
___(___ ~ ___, data = sales.data)
# Explain SALES by PRICE
linear.model <- ___(___ ~ ___, data = sales.data)
# Add the model predictions
___(___)