Introduction

This report provides a forecast of iPhone sales volumes using the Bass Model. The Bass Model is a well-known approach to modeling the adoption of new products and technologies, making it a suitable choice for forecasting sales of consumer electronics like the iPhone.

Data Summary

The dataset contains quarterly iPhone sales data starting from the third quarter of 2007. Here is a brief overview of the initial sales data:

# Load the sales data
iphone_data <- read.csv("iphone_sales.csv", header = TRUE)
head(iphone_data)
##   Sales Quarter Year
## 1 0.270       3 2007
## 2 1.119       4 2007
## 3 2.315       1 2008
## 4 1.793       2 2008
## 5 0.717       3 2008
## 6 6.892       4 2008
# Load libraries
library(ggplot2)

Sales Data Analysis

Quarterly iPhone Sales

The following plot visualizes the quarterly sales of iPhones, showing an increasing trend over time with noticeable seasonal fluctuations.

# Convert to time series
Sales <- ts(iphone_data$Sales, start=c(2007,3), freq=4)

# Plot the data
ggplot() +
  geom_line(aes(x = time(Sales), y = Sales), colour = "red", linetype = "dashed") +
  geom_point(aes(x = time(Sales), y = Sales), colour = "blue") +
  labs(x = "Time", y = "Sales (millions)", title = "Quarterly iPhone Sales (millions)")
## Don't know how to automatically pick scale for object of type <ts>. Defaulting
## to continuous.
## Don't know how to automatically pick scale for object of type <ts>. Defaulting
## to continuous.

Cumulative iPhone Sales

Cumulative sales show the total volume of iPhones sold over time. The plot reveals an exponential growth trend.

Y <- cumsum(Sales)
Y <- ts(Y, start=c(2007,3), freq=4)

# Plot cumulative sales
ggplot() +
  geom_line(aes(x = time(Y), y = Y), colour = "red", linetype = "dashed") +
  geom_point(aes(x = time(Y), y = Y), colour = "blue") +
  labs(x = "Time", y = "Cumulative Sales (millions)", title = "Cumulative iPhone Sales (millions)")
## Don't know how to automatically pick scale for object of type <ts>. Defaulting
## to continuous.
## Don't know how to automatically pick scale for object of type <ts>. Defaulting
## to continuous.

Bass Model Estimation and Forecast

Model Estimation

The Bass Model parameters were estimated using a regression model. The summary statistics of this model are as follows:

# Bass Model compute m,p, q
Y=c(0,Y[1:(length(Y)-1)])  # we want Y_t-1 not Y_t.  Y_0 = 0
Y
##  [1]   0.000   0.270   1.389   3.704   5.497   6.214  13.106  17.469  21.262
## [10]  26.550  33.917  42.654  51.406  59.804  73.946  90.181 108.828 129.166
## [19] 146.239 183.283 218.347 244.375 270.285
Ysq=Y**2
out=lm(Sales~Y+Ysq)
summary(out)
## 
## Call:
## lm(formula = Sales ~ Y + Ysq)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -10.3056  -1.1951  -0.4017   0.8912  11.0888 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.4752541  1.7170236   0.859 0.400415    
## Y            0.2050036  0.0438064   4.680 0.000144 ***
## Ysq         -0.0002572  0.0001756  -1.464 0.158639    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 4.949 on 20 degrees of freedom
## Multiple R-squared:  0.8693, Adjusted R-squared:  0.8563 
## F-statistic: 66.54 on 2 and 20 DF,  p-value: 1.45e-09
a=out$coef[1]
b=out$coef[2]
c=out$coef[3]
a
## (Intercept) 
##    1.475254
b
##         Y 
## 0.2050036
c
##           Ysq 
## -0.0002571601
mplus = (-b+sqrt(b**2-4*a*c))/(2*c)
mminus = (-b-sqrt(b**2-4*a*c))/(2*c)
mplus
##         Y 
## -7.132421
mminus
##        Y 
## 804.3153
m=mminus
p=a/m
q=b+p

m
##        Y 
## 804.3153
p
## (Intercept) 
## 0.001834174
q
##         Y 
## 0.2068378
bassModel=function(p,q,m,T=100)
{
  S=double(T)
  Y=double(T+1)
  Y[1]=0
  for(t in 1:T)
  {
    S[t] = p*m +(q-p)*Y[t] -(q/m)*Y[t]**2
    Y[t+1]=Y[t]+S[t]
  }
  return(list(Sales=S, cumSales=cumsum(S)))
}  

#
# compute
# Output the summary of the regression model
summary(out)
## 
## Call:
## lm(formula = Sales ~ Y + Ysq)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -10.3056  -1.1951  -0.4017   0.8912  11.0888 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  1.4752541  1.7170236   0.859 0.400415    
## Y            0.2050036  0.0438064   4.680 0.000144 ***
## Ysq         -0.0002572  0.0001756  -1.464 0.158639    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 4.949 on 20 degrees of freedom
## Multiple R-squared:  0.8693, Adjusted R-squared:  0.8563 
## F-statistic: 66.54 on 2 and 20 DF,  p-value: 1.45e-09

Forecasting Sales

The following plots compare the actual sales data against the forecasted data from the Bass Model for both quarterly and cumulative figures.

# Spred = Sales predicted

Spred=bassModel(p,q,m, T=23)$Sales
Spred=ts(Spred,start=c(2007,3), freq=4)
ts.plot(Sales, Spred, col=c("blue", "red"))
legend("topleft", legend=c("actual", "Bass Model"), fill=c("blue", "red"))

# cumulative sales

Spred=bassModel(p,q,m)$Sales
CumSpred=ts(cumsum(Spred),start=c(2007,3), freq=4)
CumSales=ts(cumsum(Sales),start=c(2007,3), freq=4)

ts.plot(CumSales, CumSpred, col=c("blue", "red"))
legend("topleft", legend=c("actual", "Bass Model"), fill=c("blue", "red"))
title("Predicted Cumulative iPhone Sales")

Conclusion

The forecast based on the Bass Model suggests that iPhone sales will continue to grow, but at a decreasing rate as the market approaches saturation. While the model provides a useful forecast, it should be noted that actual sales can be influenced by factors not accounted for in the model, such as changes in consumer preferences, market conditions, and competitive actions.