A linear probability model for beer demand
To see how much of an effect changes in the price ratio have on the purchases probabilities of Hoppiness, you describe the relation HOPPINESS ~ price.ratio by using the function lm(). This time, you also directly graph the estimated model by using the functions plot() and abline().
Cet exercice fait partie du cours
<cours>Building Response Models in R</cours>Instructions de l’exercice
- Use the function
lm()to explain the purchase probabilities forHOPPINESSbyprice.ratio. Assign the result to an object namedprobability.model. - Display the relation between
HOPPINESSandprice.ratioby using the functionplot(). - Add the model predictions by applying the function
abline()to theprobability.modelobject.
Exercice interactif pratique
Essayez cet exercice en complétant ce code d’exemple.
# Explain HOPPINESS by price.ratio
probability.model <- lm(___, data = choice.data)
# Plot HOPPINESS against price.ratio
___(___, data = choice.data)
# Add the model predictions
___(___)