var.asdummy {MCI} | R Documentation |
Creating dummy variables
Description
This function creates a dataset of dummy variables based on an input character vector.
Usage
var.asdummy(x)
Arguments
x |
A character vector |
Details
In MCI analyzes (as in OLS regression models generally) only quantitative information (that means: numeric) is allowed. Qualitative information (e.g. brands, companies, retail chains) can be added using dummy variables [1,0]. This function transforms a character vector x
with c
characteristics to a set of c
dummy variables whose column names correspond to these characteristics marked with “_DUMMY”.
Value
A data.frame
with dummy variables corresponding to the levels of the input variable.
Author(s)
Thomas Wieland
References
Nakanishi, M./Cooper, L. G. (1982): “Simplified Estimation Procedures for MCI Models”. In: Marketing Science, 1, 3, p. 314-322.
Tihi, B./Oruc, N. (2012): “Competitive Location Assessment - the MCI Approach”. In: South East European Journal of Economics and Business, 7, 2, p. 35-49.
Wieland, T. (2015): “Raeumliches Einkaufsverhalten und Standortpolitik im Einzelhandel unter Beruecksichtigung von Agglomerationseffekten. Theoretische Erklaerungsansaetze, modellanalytische Zugaenge und eine empirisch-oekonometrische Marktgebietsanalyse anhand eines Fallbeispiels aus dem laendlichen Raum Ostwestfalens/Suedniedersachsens”. Geographische Handelsforschung, 23. 289 pages. Mannheim : MetaGIS.
Examples
charvec <- c("Peter", "Paul", "Peter", "Mary", "Peter", "Paul")
# Creates a vector with three names (Peter, Paul, Mary)
var.asdummy(charvec)
# Returns a data frame with 3 dummy variables
# (Mary_DUMMY, Paul_DUMMY, Peter_DUMMY)
data(grocery2)
# Loads the data
dummyvars <- var.asdummy(grocery2$store_chain)
# Save the dummy variable set into a new dataset
mynewmcidata <- data.frame(grocery2, dummyvars)
# Add the dummy dataset to the input dataset