huff.attrac {MCI} | R Documentation |
Local optimization of attraction values in the Huff Model
Description
This function optimizes the attraction 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, origin_id, 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 |
origins |
the column in the interaction matrix |
locations |
the column in the interaction matrix |
attrac |
the column in the interaction matrix |
dist |
the column in the interaction matrix |
lambda |
a single numeric value of |
dtype |
Type of distance weighting function: |
lambda2 |
if |
localmarket_dataset |
A |
origin_id |
the column in the dataset |
localmarket |
the column in the dataset |
location_dataset |
A |
location_id |
the column in the dataset |
location_total |
the column in the dataset |
tolerance |
accepted value of absolute percentage error between observed ( |
output |
Type of function output: |
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: |
check_df |
logical argument that indicates if the given dataset is checked for correct input, only for internal use, should not be deselected (default: |
Details
In many cases, only total empirical values of the suppliers/locations can be used for market area estimation. This function fits the Huff model not by estimating the parameters but by optimizing the attraction variable (transport cost weighting by \lambda
is given) using an optimization algorithm based on the idea of the local optimization of attraction algorithm developed by Guessefeldt (2002) and other model fit approaches. 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).
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 attraction 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 attraction values are returned. All results are data.frame
.
Author(s)
Thomas Wieland
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
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, "district", "ppower", Freiburg3, "store", "annualsales",
# tolerance = 5, output = "total")
# Local optimization of store attraction using the function huff.attrac()
# returns a data frame with total values (observed and expected after optimization)