This function fits diffusion curves that can be of "bass",
"gompertz" or "gsgompertz" type.
diffusion(x, w = NULL, cleanlead = c(TRUE, FALSE), prew = NULL, l = 2,
cumulative = c(TRUE, FALSE), pvalreps = 0, eliminate = c(FALSE, TRUE),
sig = 0.05, verbose = c(FALSE, TRUE), type = c("bass", "gompertz",
"gsgompertz"), optim = c("nm", "hj"), maxiter = Inf, opttol = 1e-06)Returns an object of class diffusion, which contains:
type diffusion curve type used
call calls function fitted
w named vector of fitted parameters
x actuals
fit fitted values of model
frc forecasts for future periods. This is NULL until predict.diffusion is called.
mse insample Mean Squared Error
prew the w of the previous generation
pval p-values for w
vector with adoption per period
vector of curve parameters (see note). If provided no estimation is done.
removes leading zeros for fitting purposes (default == TRUE)
Experimental. Ignore!
the l-norm (1 is absolute errors, 2 is squared errors).
If TRUE optimisation is done on cumulative adoption.
Experimental. Ignore!
Experimental. Ignore!
Experimental. Ignore!
if TRUE console output is provided during estimation (default == FALSE)
diffusion curve to use. This can be "bass", "gompertz" and "gsgompertz"
optimization method to use. This can be "nm" for Nelder-Meade or "hj" for Hooke-Jeeves.
number of iterations the optimser takes (default ==
10000 for "nm" and Inf for "hj")
Tolerance for convergence (default == 1.e-06)
The optimisation of the Bass curve is initialisated by the linear aproximation suggested in Bass (1969).
The initialisation of the Gompertz curve uses the approach suggested by Jukic et al. (2004), but is adapted to allow for the non-exponential version of Gompertz curve. This makes the market potential parameter equivalent to the Bass curves's and the market potential from Bass curve is used for initialisation.
The curve is initialised by assuming the shift operator to be 1 and becomes equivalent to the Bass curve, as shown in Bemmaor (1994). A Bass curve is therefore used as an estimator for the remaining initial parameters.
Oliver Schaer, info@oliverschaer.ch,
Nikoloas Kourentzes, nikoloas@kourentzes.com
For an introduction to diffusion curves see: Ord K., Fildes R., Kourentzes N. (2017) Principles of Business Forecasting 2e. Wessex Press Publishing Co., Chapter 12.
Bass, F.M., 1969. A new product growth for model consumer durables. Management Science 15(5), 215-227.
Bemmaor, A. 1994. Modeling the Diffusion of New Durable Goods: Word-of-Mouth Effect versus Consumer Heterogeneity. In G. Laurent, G.L. Lilien and B. Pras (Eds.). Research Traditions in Marketing. Boston: Kluwer, pp. 201-223.
Jukic, D., Kralik, G. and Scitovski, R., 2004. Least-squares fitting Gompertz curve. Journal of Computational and Applied Mathematics, 169, 359-375.
predict.diffusion, plot.diffusion and print.diffusion.
fitbass <- diffusion(tsChicken[, 2], type = "bass")
fitgomp <- diffusion(tsChicken[, 2], type = "gompertz")
fitgsg <- diffusion(tsChicken[, 2], type = "gsgompertz")
# Produce some plots
plot(fitbass)
plot(fitgomp)
plot(fitgsg)
Run the code above in your browser using DataLab