diffusion: Fit various diffusion curves.

Description Usage Arguments Value Bass curve Gompertz curve Gamma/Shifted Gompertz Weibull Note Author(s) References See Also Examples

View source: R/diffusion.R

Description

This function fits diffusion curves that can be of "bass", "gompertz", "gsgompertz" (Gamma/Shifted Gompertz curve) or "Weibull" type.

Usage

1
2
3
4
5
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", "weibull"), optim = c("nm", "hj"), maxiter = Inf,
  opttol = 1e-06)

Arguments

x

vector with adoption per period

w

vector of curve parameters (see note). If provided no estimation is done.

cleanlead

removes leading zeros for fitting purposes (default == TRUE)

prew

Experimental. Ignore! the w of the previous generation. This is used for sequential fitting.

l

the l-norm (1 is absolute errors, 2 is squared errors).

cumulative

If TRUE optimisation is done on cumulative adoption.

pvalreps

Experimental. Ignore! bootstrap repetitions to estimate (marginal) p-values

eliminate

Experimental. Ignore! if TRUE eliminates insignificant parameters from the estimation. Forces pvalreps = 1000 if left to 0.

sig

Experimental. Ignore! significance level used to eliminate parameters

verbose

if TRUE console output is provided during estimation (default == FALSE)

type

diffusion curve to use. This can be "bass", "gompertz" and "gsgompertz"

optim

optimization method to use. This can be "nm" for Nelder-Meade or "hj" for Hooke-Jeeves.

maxiter

number of iterations the optimser takes (default == 10000 for "nm" and Inf for "hj")

opttol

Tolerance for convergence (default == 1.e-06)

Value

Returns an object of class diffusion, which contains:

Bass curve

The optimisation of the Bass curve is initialisated by the linear aproximation suggested in Bass (1969).

Gompertz curve

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.

Gamma/Shifted Gompertz

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.

Weibull

The initialisation is obatained through by a linear approximation median-ranked OLS described in Sharif and Islam 1980.

Note

vector w needs to be provided for the Bass curve in the order of "p", "q", "m", where "p" is the coefficient of innovation, "q" is the coefficient of imitation and "m" is the market size coefficient.

For the Gompertz curve, vector w needs to be in the form of ("a", "b", "m"). Where "a" is the x-axis displacement coefficient, "b" determines the growth rate and "m" sets, similarly to Bass model, the market potential (saturation point).

For the Shifted-Gompertz curve, vector w needs to be in the form of ("a", "b", "c", "m"). Where "a" is the x-axis displacement coefficient, "b" determines the growth rate, "c" is the shifting parameter and "m" sets, similarly to Bass model, the market potential (saturation point).

For the Weibull curve, vector w needs to be in the form of \cod("a", "b", "m"). Where "a" is the scale parameter, "b" determines the shape. Together, "a" and "b" determine the stepness of the curve. The "m" parameter sets the market potential (saturation point).

Parameters are estimated by minimising the Mean Squared Error with a Subplex algorithm from the nloptr package. Optionally p-values of the coefficients can be determined via bootstraping. Furthermore, the bootstrapping allows to remove insignificant parameters from the optimisation process.

Author(s)

Oliver Schaer, [email protected],

Nikoloas Kourentzes, [email protected]

References

See Also

predict.diffusion, plot.diffusion and print.diffusion.

seqdiffusion for sequential diffusion model fitting across product generations.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
 fitbass <- diffusion(diff(tsChicken[, 2]), type = "bass")
 fitgomp <- diffusion(diff(tsChicken[, 2]), type = "gompertz")
 fitgsg <- diffusion(diff(tsChicken[, 2]), type = "gsgompertz")
 fitgwb <- diffusion(diff(tsChicken[, 2]), type = "weibull")
 
 # Produce some plots
 plot(fitbass)
 plot(fitgomp)
 plot(fitgsg)
 plot(fitgwb)

mamut86/diffusion documentation built on Jan. 29, 2019, 6:22 p.m.