Learn R Programming

MCI (version 1.3.3)

var.asdummy: 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

Value

A data.frame with dummy variables corresponding to the levels of the input variable.

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”.

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

Run this code
# NOT RUN {
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
# }

Run the code above in your browser using DataLab