进行预测
为改进定价决策,营销经理需要了解在不同单价下可预期的销量。特别是,他想知道当单价为 1.05 和 0.95 时的预期销量是多少。
您可以使用之前拟合的线性销售响应模型的系数进行预测。coef() 函数会返回一个包含 2 个元素的数值型系数向量:第 1 个元素是 linear.model 对象的销售截距,第 2 个元素是价格斜率。您可以通过将价格斜率分别乘以 1.05 和 0.95,并加到销售截距上,来计算预期销量。
本练习是课程的一部分
在 R 中构建响应模型
练习说明
- 使用函数
coef()从linear.model对象中获取估计系数。通过数值索引分别提取销售截距和价格斜率。 - 计算当单价为 1.05 和 0.95 时的预期销量。
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Obtain the intercept coefficient
coef(linear.model)[___]
# Obtain the slope coefficient
coef(linear.model)[___]
# Calculate the volume sales for the unit price of 1.05
___(linear.model)[___] + ___ * ___(linear.model)[___]
# Calculate the volume sales for the unit price of 0.95
___(___)[___] + ___ * ___(___)[___]