View source: R/attraction_data.R
attraction_data | R Documentation |
Prepare a data set (in long format) to its base-brand representation, so that it can be estimated using SUR or maximum likelihood.
attraction_data(formula, data = NULL, subset = NULL, heterogenous = NULL, index = NULL, model = "MCI", benchmark = NULL, ...)
formula |
a two-sided linear formula object describing the attraction model to be estimated, with the market share on the left of a |
data |
an optional data frame containing the variables named in
|
heterogenous |
a one-sided formula object, with variables on the right of a |
index |
a one-sided formula object, with two variables on the right of a |
model |
specifies the transformation type that will be applied to the data. Can be one of |
benchmark |
character vector, specifying the benchmark brand to be chosen for normalization; default of |
subset |
an optional expression indicating the subset of the rows
of |
... |
other potential arguments. Currently not implemented. |
...
An object of class attr.data
, for which some methods
are available (e.g., show).
Cooper, L. G., & Nakanishi, M. (1988). Market-share analysis: Evaluating competitive marketing effectiveness. Boston: Kluwer Academic Publishers.
Fok, D., Franses, P. H., & Paap, R. (2001). Econometric analysis of the market share attraction model.
itersur
for details on how to estimate the model.
# Load package require(marketingtools) # Simulate raw data rawdata <- do.call('cbind', attraction_simulate_data()) head(rawdata) # Transform to base-brand representation dtbb <- attraction_data(formula = y ~ X.var_3 + X.var_4 + X.var_5 + X.var_1 + X.var_2, heterogenous = ~ X.var_1 + X.var_2, index = ~ index.var + index.t, data=rawdata, model="MCI") # verify object validObject(dt) # show a summary about the transformed data show(dt) # Estimate model using itersur (FGLS) m <- itersur(X=dtbb@X,Y=as.matrix(dtbb@y), index=data.frame(date=dtbb@period,brand=dtbb@individ), method = "FGLS") show(m) # summarize m print(m@sigma) # show contemporaneous variance-covariance matrix # Estimate model using itersur with correction for autocorrelation in the residuals (FGLS-Praise-Winsten) m <- itersur(X=dtbb@X,Y=as.matrix(dtbb@y), index=data.frame(date=dtbb@period,brand=dtbb@individ), method = "FGLS-Praise-Winsten") show(m) # summarize m print(m@sigma) # show contemporaneous variance-covariance matrix
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.