開始使用免費開始

進行預測

為了改進定價決策,行銷經理需要知道在不同單位價格下,預期可以達到多少銷量。特別是,他想知道當單位價格為 1.05 與 0.95 時的預期銷量是多少。

你可以用先前擬合好的線性銷售反應模型的係數來做這些預測。coef() 函式會回傳一個包含兩個元素的數值係數向量:第 1 個元素是銷售截距,第 2 個元素是 linear.model 物件中的價格斜率。你只要將價格斜率分別乘上 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 
___(___)[___] + ___ * ___(___)[___]
編輯並執行程式碼