huff.fit(huffdataset, origins, locations, attrac, dist, lambda = -2, dtype = "pow",
lambda2 = NULL, localmarket_dataset, localmarket, location_dataset, location_id,
location_total, tolerance = 5, iterations = 3, output = "total", show_proc = FALSE,
check_df = TRUE)data.frame containing the origins, locations and the explanatory variables (attractivity, transport costs)
huffdataset containing the origins (e.g. ZIP codes)
huffdataset containing the locations (e.g. store codes)
huffdataset containing the attractivity variable (e.g. sales area)
huffdataset containing the transport costs (e.g. travelling time or street distance)
dtype = "pow" (power function), dtype = "exp" (exponential function) or dtype = "logistic" (default: dtype = "pow")
dtype = "logistic" a second $\lambda$ parameter is needed
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_dataset containing the local market potential (e.g. purchasing power, number of customers)
data.frame containing the suppliers/locations and their observed total values
location_dataset containing the locations (e.g. store codes), $j$, according to the codes in huffdataset
location_dataset containing the observed total values of suppliers/locations, $T_{j,obs}$ (e.g. annual sales, total number of customers)
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 = FALSE (messages off)
TRUE)
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 = "diag", the diagnosis results (fitting measures) are returned. All results are data.frame.
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 iteratively (transport cost weighting by $\lambda$ is given) using a modified version of the local optimization of attractivity algorithm developed by Guessefeldt (2002). The fitting process includes of given number of ($m$) iterations, while the fit gets better with every iteration. The algorithm results can be evaluated by several diagnosis criteria which have been frequently used to evaluate Huff model results: Besides the sum of squared residuals, the function also calculates a Pseudo-R-squared measure and the MAPE (mean average percentage error), both used by De Beule et al. (2014), and the global error used by Klein (1988).
Guessefeldt, J. (2002): Zur Modellierung von raeumlichen Kaufkraftstroemen in unvollkommenen Maerkten. In: Erdkunde, 56, 4, p. 351-370.
Klein, R. (1988): Der Lebensmittel-Einzelhandel im Raum Verden. Raeumliches Einkaufsverhalten unter sich wandelnden Bedingungen. Flensburger Arbeitspapiere zur Landeskunde und Raumordnung, 6. Flensburg.
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
huff.attrac, huff.shares, huff.decay
data(Freiburg1)
data(Freiburg2)
data(Freiburg3)
# Loading the three Freiburg datasets
# NOTE: This may take a while!
# Loading the three Freiburg datasets
# huff.fit(Freiburg1, "district", "store", "salesarea", "distance", lambda = -2, dtype= "pow",
# lambda2 = NULL, Freiburg2, "ppower", Freiburg3, "store", "annualsales", tolerance = 5,
# iterations = 2, output = "total")
# Local optimization of store attractivity with two iterations using the function huff.fit()
# returns a data frame with total values (observed and expected after optimization)
Run the code above in your browser using DataLab