Learn R Programming

MCI (version 1.2.0)

huff.attrac: Local optimization of attractivity values in the Huff Model

Description

This function optimizes the attractivity values of suppliers/location in a given Huff interaction matrix to fit empirically observed total values (e.g. annual sales) and calculates market shares/market areas

Usage

huff.attrac(huffdataset, origins, locations, attrac, dist, lambda = -2, dtype = "pow", lambda2 = NULL, localmarket_dataset, localmarket, location_dataset, location_id, location_total, tolerance = 5, output = "matrix", show_proc = FALSE, check_df = TRUE)

Arguments

huffdataset
an interaction matrix which is a data.frame containing the origins, locations and the explanatory variables (attractivity, transport costs)
origins
the column in the interaction matrix huffdataset containing the origins (e.g. ZIP codes)
locations
the column in the interaction matrix huffdataset containing the locations (e.g. store codes)
attrac
the column in the interaction matrix huffdataset containing the attractivity variable (e.g. sales area)
dist
the column in the interaction matrix huffdataset containing the transport costs (e.g. travelling time or street distance)
lambda
a single numeric value of $\lambda$ for the (exponential) weighting of distance (transport costs, default: -2)
dtype
Type of distance weighting function: dtype = "pow" (power function), dtype = "exp" (exponential function) or dtype = "logistic" (default: dtype = "pow")
lambda2
if dtype = "logistic" a second $\lambda$ parameter is needed
localmarket_dataset
A data.frame containing the origins saved in a column which has the same name as in huffdataset and another column containing the local market potential
localmarket
the column in the dataset localmarket_dataset containing the local market potential (e.g. purchasing power, number of customers)
location_dataset
A data.frame containing the suppliers/locations and their observed total values
location_id
the column in the dataset location_dataset containing the locations (e.g. store codes), $j$, according to the codes in huffdataset
location_total
the column in the dataset location_dataset containing the observed total values of suppliers/locations, $T_{j,obs}$ (e.g. annual sales, total number of customers)
tolerance
accepted value of relative difference between observed ($T_{j,obs}$) and modeled total values $T_{j,exp}$ to skip a local optimization of location/supplier $j$
output
Type of function output: output = "matrix" returns a Huff interaction matrix with the optimized attractivity values and the expected market shares/market areas. If output = "total", the old (observed) and the new (expected) total values are returned. If output = "total", the optimized attractivity values are returned.
show_proc
logical argument that indicates if the function prints messages about the state of process during the work (e.g. “Processing variable xyz ...” or “Variable xyz is regarded as dummy variable”). Default: show_proc = FALSE (messages off)
check_df
logical argument that indicates if the given dataset is checked for correct input, only for internal use, should not be deselected (default: TRUE)

Value

The function output can be controlled by the function argument output. If output = "matrix" the function returns a Huff interaction matrix with the optimized attractivity values and the expected market shares/market areas. If output = "total", the old (observed) and the new (expected) total values are returned. If output = "attrac", the optimized attractivity values are returned. All results are data.frame.

Details

The Huff model (Huff 1962, 1963, 1964) is the most popular spatial interaction model for retailing and services and belongs to the family of probabilistic market area models. The basic idea of the model, derived from the Luce choice axiom, is that consumer decisions are not deterministic but probabilistic, so the decision of customers for a shopping location in a competitive environment cannot be predicted exactly. The results of the model are probabilities for these decisions, which can be interpreted as market shares of the regarded locations ($j$) in the customer origins ($i$), $p_{ij}$. The model results can be regarded as an equilibrium solution (consumer equilibrium) with logically consistent market shares (0 < $p_{ij}$ < 1, $\sum_{j=1}^n{p_{ij} = 1}$). From a theoretical perspective, the model is based on an utility function with two explanatory variables ("attractivity" of the locations, transport costs between origins and locations), which are weighted by an exponent: $U_{ij}=A_{j}^\gamma d_{ij}^{-\lambda}$. But the weighting functions can also be exponential or logistic. When the "real" local market shares were observed, the model can be fit by using the log-centering transformation resp. the MCI model (see the functions mci.fit(), mci.transmat() and mci.transvar()). In many cases, only total empirical values of the suppliers/locations can be used for fitting the model. This function fits the Huff model not by estimating the parameters but by optimizing the attractivity variable (transport cost weighting by $\lambda$ is given) using a modified version of the local optimization of attractivity algorithm developed by Guessefeldt (2002). This function consists of a single optimization of every supplier/location. Note that the best results can be achieved by repeating the algorithm while evaluating the results (see the function huff.fit(), which extends this algorithm to a given number of iterations).

References

Guessefeldt, J. (2002): “Zur Modellierung von raeumlichen Kaufkraftstroemen in unvollkommenen Maerkten”. In: Erdkunde, 56, 4, p. 351-370.

Wieland, T. (2015): “Nahversorgung im Kontext raumoekonomischer Entwicklungen im Lebensmitteleinzelhandel - Konzeption und Durchfuehrung einer GIS-gestuetzten Analyse der Strukturen des Lebensmitteleinzelhandels und der Nahversorgung in Freiburg im Breisgau”. Projektbericht. Goettingen : GOEDOC, Dokumenten- und Publikationsserver der Georg-August-Universitaet Goettingen. http://webdoc.sub.gwdg.de/pub/mon/2015/5-wieland.pdf

See Also

huff.fit, huff.shares, huff.decay

Examples

Run this code
data(Freiburg1)
data(Freiburg2)
data(Freiburg3)
# Loading the three Freiburg datasets

# NOTE: This may take a while!
# huff.attrac(Freiburg1, "district", "store", "salesarea", "distance", lambda = -2, dtype= "pow",
# lambda2 = NULL, Freiburg2, "ppower", Freiburg3, "store", "annualsales", tolerance = 5, 
# output = "total")
# Local optimization of store attractivity using the function huff.attrac()
# returns a data frame with total values (observed and expected after optimization)

Run the code above in your browser using DataLab