R語言使用Bass模型進行手機市場產品周期預測
原文鏈接:http://tecdat.cn/?p=17725?
原文出處:拓端數(shù)據部落公眾號
?
主要觀點
巴斯Bass擴散模型已成功地用于預測各種新推出的產品以及成熟產品的市場份額。
該模型的主要思想來自兩個來源:
消費者不受社會影響的產品意愿。
因為其他人已經采用了該產品,所以傾向于采用該產品。因此,在優(yōu)質產品的生命周期中的早期采用者的影響變得足夠強大,以致驅使許多其他人也采用該產品。
Bass模型顯示了如何使用銷售數(shù)據的前幾個時期的信息來對未來的銷售做出相當好的預測??梢院苋菀椎乜闯?,雖然該模型來自營銷領域,但它也可以很容易地用于對現(xiàn)金流量的預測進行建模以確定初創(chuàng)公司的價值。
歷史事例
Bass模型的文獻中有一些經典的例子。例如,請參見下圖所示的80年代VCR的實際與預測市場增長情況。
?
?
基本思想
將單個人從零時間到時間tt購買產品的累計概率定義為F(t)。那么,在時間tt的購買概率為密度函數(shù)f(t)= F'(t)。
從目前來看,在目前沒有購買的情況下,時間t的購買率符合邏輯,即
?
建模就像在給定時間t建模產品的采用率
微分方程
巴斯建議將此采用率定義為
?
在這里,我們可以將p定義為?采用產品的消費者的??獨立比率,將q定義為模仿率,因為q可以??模擬累積采用強度F(t)的影響。
因此,如果我們可以找到某產品的p和q,則可以預測其隨著時間的采用,從而生成銷售的時間路徑。總結一下:
p:創(chuàng)新系數(shù)。
q:模仿系數(shù)。
求解F(t)的模型
我們重寫方程:
并注意F(0)= 0。
解決方案中的步驟是:
另一種解決方案
一種替代方法(這是學生Muhammad Sagarwalla根據Alexey Orlovsky的想法提出的)如下。
?
所以我們寫
?
?
?
我們得到
?
?
?
與公式(*)相同。以前的解決方案是
?
?
求解f(t)
?
?因此,如果目標市場的大小為m,則在每個t處,采用率簡單地由m×f(t)給出。
例
例如,設置m = 100,000,p = 0.01和q = 0.2。然后,采用率如下圖所示。
f = function(p,q,t) {
p = 0.01
q = 0.20
plot(t,m*f(p,q,t),type="l",col="blue",l
?
?
?
R中的符號數(shù)學
#BASS 模型
FF = expression(p*(exp((p+q)*t)-1)/(p*exp((p+q)*t)+q))
## expression(p * (exp((p + q) * t) - 1)/(p * exp((p + q) * t) +
## ? ? q))
#取導數(shù)
D(FF,"t")
## p * (exp((p + q) * t) * (p + q))/(p * exp((p + q) * t) + q) -
## ? ? p * (exp((p + q) * t) - 1) * (p * (exp((p + q) * t) * (p +
## ? ? ? ? q)))/(p * exp((p + q) * t) + q)^2
#設置函數(shù)
ff = function(p,q,t) {
res
#評估
plot(t,m*eval(ff(p,q,t)),type="l",col="red",lwd=3)
?
?
iPhone銷售預測
例如,讓我們看一下iPhone銷量的趨勢(我們將季度銷量存儲在一個文件中并讀入文件,然后進行Bass模型分析)。
此計算的R代碼如下:
#使用蘋果iPHONE銷售數(shù)據
data = read.table("tecdat/iphone.txt",header=TRUE)
## ? Quarter Sales_MM_units
## 1 ? Q3_07 ? ? ? ? ? 0.27
## 2 ? Q4_07 ? ? ? ? ? 1.12
## 3 ? Q1_08 ? ? ? ? ? 2.32
## 4 ? Q2_08 ? ? ? ? ? 1.70
## 5 ? Q3_08 ? ? ? ? ? 0.72
## 6 ? Q4_08 ? ? ? ? ? 6.89
print(tail(data))
## ? ?Quarter Sales_MM_units
## 30 ? Q4_14 ? ? ? ? ?39.27
## 31 ? Q1_15 ? ? ? ? ?74.47
## 32 ? Q2_15 ? ? ? ? ?61.17
## 33 ? Q3_15 ? ? ? ? ?47.53
## 34 ? Q4_15 ? ? ? ? ?48.05
## 35 ? Q1_16 ? ? ? ? ?74.78
##
## Call:
## lm(formula = isales ~ cum_isales + cum_isales2)
##
## Residuals:
## ? ? Min ? ? ?1Q ?Median ? ? ?3Q ? ? Max
## -14.050 ?-3.413 ?-1.429 ? 2.905 ?19.987
##
## Coefficients:
## ? ? ? ? ? ? ? Estimate Std. Error t value Pr(>|t|)
## (Intercept) ?3.696e+00 ?2.205e+00 ? 1.676 ? 0.1034
## cum_isales ? 1.130e-01 ?1.677e-02 ? 6.737 1.31e-07 ***
## cum_isales2 -5.508e-05 ?2.110e-05 ?-2.610 ? 0.0136 *
## ---
## Signif. codes: ?0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.844 on 32 degrees of freedom
## Multiple R-squared: ?0.8729, Adjusted R-squared: ?0.865
## F-statistic: 109.9 on 2 and 32 DF, ?p-value: 4.61e-15
b = res$coefficients
#擬合模型
m1 = (-b[2]+sqrt(b[2]
m2 = (-b[2]-sqrt(b[2]^2-4
## cum_isales cum_isales
## ?-32.20691 2083.82202
## [1] 2083.822
## ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (Intercept) ? ? ? ? ? cum_isales2
## ? ? ? ? ? ? ? ?"p,q=" "0.00177381124189973" ? "0.114767511363674"
##繪制擬合的模型
plot(t,fn_f,type="l"
lines(1:n,isales,col="red",lwd=2,lty=2)
?
三星Galaxy手機銷量
#讀取Galaxy銷售數(shù)據
data = read.csv("tecdat/galaxy.csv")
#獲取系數(shù)
res = lm(isales ~ cum_isales+cum_isales2)
print(summary(res))
## Residuals:
## ? ? ?Min ? ? ? 1Q ? Median ? ? ? 3Q ? ? ?Max
## -11.1239 ?-6.1774 ? 0.4633 ? 5.0862 ?13.2662
##
## Coefficients:
## ? ? ? ? ? ? ? Estimate Std. Error t value Pr(>|t|)
## (Intercept) ?5.375e+01 ?4.506e+00 ?11.928 2.87e-10 ***
## cum_isales ? 7.660e-02 ?1.068e-02 ? 7.173 8.15e-07 ***
## cum_isales2 -2.806e-05 ?5.074e-06 ?-5.530 2.47e-05 ***
## ---
## Signif. codes: ?0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.327 on 19 degrees of freedom
## Multiple R-squared: ?0.8206, Adjusted R-squared: ?0.8017
## F-statistic: 43.44 on 2 and 19 DF, ?p-value: 8.167e-08
b = res$coefficients
#擬合模型
m1 = (-b[2]+sqrt(b[2]^2-4*
m2 = (-b[2]-sqrt(b[2]^
print(c(m1,m2))
## cum_isales cum_isales
## ?-578.9157 ?3308.9652
## [1] 3308.965
## ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (Intercept) ? ? ? ? ?cum_isales2
## ? ? ? ? ? ? ? "p,q=" "0.0162432614649845" "0.0928432001791269"
#繪制擬合模型
nqtrs = 100
t=seq(0
plot(t,fn_f,type="l"
lines(1:n,isales,col="red",lwd=2,lty=2)
?
?
全球半導體銷量
#讀取半導體銷售數(shù)據
data = read.csv("tecdat/semi.csv")
#獲取系數(shù)
isales = d
res = lm(isales ~ cum_isales+cum_isales2)
## Residuals:
## ? ? Min ? ? ?1Q ?Median ? ? ?3Q ? ? Max
## -42.359 -12.415 ? 0.698 ?12.963 ?45.489
##
## Coefficients:
## ? ? ? ? ? ? ? Estimate Std. Error t value Pr(>|t|)
## (Intercept) ?5.086e+01 ?8.627e+00 ? 5.896 3.76e-06 ***
## cum_isales ? 9.004e-02 ?9.601e-03 ? 9.378 1.15e-09 ***
## cum_isales2 -6.878e-06 ?1.988e-06 ?-3.459 ?0.00196 **
## ---
## Signif. codes: ?0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 21.46 on 25 degrees of freedom
## Multiple R-squared: ?0.9515, Adjusted R-squared: ?0.9476
## F-statistic: 245.3 on 2 and 25 DF, ?p-value: < 2.2e-16
#擬合模型
m1 = (-b[2]+sqrt(b[2]^2
m2 = (-b[2]-sqrt(b[
print(c(m1,m2))
## cum_isales cum_isales
## ?-542.4036 13633.3003
## [1] 13633.3
## ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (Intercept) ? ? ? ? ? cum_isales2
## ? ? ? ? ? ? ? ?"p,q=" "0.00373048366213552" ?"0.0937656034785294"
#繪制擬合的模型
plot(t,fn_f,type="l",
lines(1:n,isales,col="red"
?
顯示數(shù)據框:
print(df)
## ? ? ? t ? V2 ? ? ? fn_f
## 1 ? ? 0 1988 ?50.858804
## 2 ? ? 1 1989 ?55.630291
## 3 ? ? 2 1990 ?60.802858
## 4 ? ? 3 1991 ?66.400785
## 5 ? ? 4 1992 ?72.447856
## 6 ? ? 5 1993 ?78.966853
## 7 ? ? 6 1994 ?85.978951
## 8 ? ? 7 1995 ?93.503005
## 9 ? ? 8 1996 101.554731
## 10 ? ?9 1997 110.145765
## 11 ? 10 1998 119.282622
## 12 ? 11 1999 128.965545
## 13 ? 12 2000 139.187272
?
權衡p vs q
在Bass模型中,如果模仿系數(shù)相對于創(chuàng)新系數(shù)增加,那么以下哪一項是最有效的?
產品生命周期的高峰發(fā)生在稍后。
產品生命周期的高峰出現(xiàn)得更快。
兩個生命周期高峰的機會可能會增加。
高峰可能遲早會出現(xiàn),具體取決于創(chuàng)新系數(shù)。
使用高峰時間公式,用x = q / p代替:
x的微分:
從Bass模型中,我們知道q> p> 0,即x> 1,否則我們可以在0≤F<1區(qū)域獲得負的接受度或形狀,而沒有最大值。因此,?t? /?x的符號與:
?
但是這個非線性方程
根x≈3.59
換句話說,當x> 3.59時,導數(shù)?t? /?x為負,而當x <3.59時為正。對于x = q / p的低值,模仿系數(shù)q的增加會增加達到銷售高峰的時間,而對于q / p的高值,時間會隨著q的增加而減少。因此,該問題的正確答案似乎是“它取決于p和q的值”。
t = seq(0,5,
.1)
p = 0.1;
lines(t,f(p,q,t),type="l",col="red",lwd=2)
?
在圖中,當x變小時,峰值更早。
最受歡迎的見解
1.在python中使用lstm和pytorch進行時間序列預測
2.python中利用長短期記憶模型lstm進行時間序列預測分析
3.使用r語言進行時間序列(arima,指數(shù)平滑)分析
4.r語言多元copula-garch-模型時間序列預測
5.r語言copulas和金融時間序列案例
6.使用r語言隨機波動模型sv處理時間序列中的隨機波動
7.r語言時間序列tar閾值自回歸模型
8.r語言k-shape時間序列聚類方法對股票價格時間序列聚類
9.python3用arima模型進行時間序列預測
?