Learn R Programming

MCI2 (version 1.1.2)

huff.optim: Huff Model optimization

Description

This function fits the Huff Model using a local optimization of attraction algorithm

Usage

huff.optim(huffmodel, location.dataset, location.id, location.total,
tolerance = 5, iterations = 3, show_proc = TRUE)

Arguments

huffmodel

Object (huffmodel list) object created by the function huff (Huff Model)

location.dataset

A data frame containing the destinations and the corresponding observed total market areas, \(T_{j,obs}\) (e.g. annual turnover)

location.id

Name of the column in location.dataset containing the destination IDs

location.total

Name of the column in location.dataset containing the destinations' observed total market areas, \(T_{j,obs}\) (e.g. annual turnover)

tolerance

Accepted value of absolute percentage error between observed (\(T_{j,obs}\)) and estimated total values (\(T_{j,exp}\)) to skip a local optimization of location \(j\)

iterations

a single numeric value for the desired number of iterations

show_proc

logical argument that indicates if the function prints messages about the state of process during the work

Value

A huffmodel list (invisible) containing the following components:

huffmat

Huff interaction matrix (data frame), also containing the local market shares (p_ij)

hufftotal

Total location market areas (data frame), also containing both the empirical and the estimated total market areas (T_j and T_j_obs, respectively) as well as their difference (T_j_diff) and the new attraction values (A_opt)

diag

A data frame containing several model diagnoses for each iteration

params

A matrix containing the user-defined weighting functions and the corresponding weighting parameters

coords

A list containing the coordinates and additional information of the origins (coords_origins) and the destinations (coords_destinations), inherited from the tcmat object

tc.mode

A list containing information about the transportation costs matrix, inherited from the tcmat object

Details

In many cases, only total empirical market areas (e.g. annual turnover) of the destinations/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 introduced and explained in Wieland (2017a) and Wieland (2017b).

References

Wieland, T. (2017a): “Market Area Analysis for Retail and Service Locations with MCI”. In: The R Journal, 9, 1, p. 298-323. https://journal.r-project.org/archive/2017/RJ-2017-020/RJ-2017-020.pdf.

Wieland, T. (2017b): “Raum- und standortoekonomische Optimierungsmodelle in Open-Source-Umgebungen - Implementation und Anwendungsmoeglichkeiten im Kontext der Einzelhandels- und Versorgungsforschung”. In: Schrenk, M./Popovich, V./Zeile, P./Elisei, P./Beyer, C. (eds.): REAL CORP 2017. PANTA RHEI - A World in Constant Motion. Proceedings of 22nd International Conference on Urban Planning, Regional Development and Information Society. p. 463-473. https://programm.corp.at/cdrom2017/papers2017/CORP2017_98.pdf.

See Also

huff, huff.newdest, huff.updest

Examples

Run this code
# NOT RUN {
# Compilation of tcmat list from existing datasets:
# (Results from the tcmat.create function)
data(Haslach_tcmatAirline)
# airline distances
data(Haslach_coords_origins)
# Coordinates of origins
data(Haslach_coords_destinations)
# Coordinates of destinationes

# Component "tc.mode":
Airline_tc.mode <- list()
Airline_tc.mode$tc.type = "airline"
Airline_tc.mode$tc.unit = "km"
Airline_tc.mode$tc.constant = 0

# tcmat with airline distances
# Compilation as a list:
tcmat_haslach_airline <- list(tcmat = Haslach_tcmatAirline,
coords_origins = Haslach_coords_origins,
coords_destinations = Haslach_coords_destinations,
tc.mode = Airline_tc.mode)

Drvtime_tc.mode <- list()
Drvtime_tc.mode$tc.type = "street"
Drvtime_tc.mode$tc.unit = "min"
Drvtime_tc.mode$tc.constant = 0

data(Haslach_tcmatDrvtime)
# car driving times

# tcmat with car driving times
# Compilation as a list:
tcmat_haslach_drvtime <- list(tcmat = Haslach_tcmatDrvtime,
coords_origins = Haslach_coords_origins,
coords_destinations = Haslach_coords_destinations,
tc.mode = Drvtime_tc.mode)

data(HaslachDistricts)
# IDs and information about customer origins
data(HaslachStores)
# IDs and information about destinations (grocery stores)

huffmodel1 <- huff (HaslachDistricts$WO, HaslachDistricts$WO_Einwohner, 
HaslachStores$LM, HaslachStores$LM_VKF, 
tcmat = tcmat_haslach_airline)
# Huff Model with standard parameters
# uses given transport costs matrix (tcmat_haslach_airline)

huffmod_total <- huffmodel1$hufftotal
# Total values from the Huff Model

huff.optim(huffmodel1, location.dataset = huffmod_total, 
location.id = "j_dest", location.total = "T_j")
# Using calculated total market areas for optimization

# now adding random errors:
rnderr <- runif(8, min=-1000, max=1500)
huffmod_total2 <- huffmod_total
huffmod_total2$T_j <- huffmod_total2$T_j+rnderr 

# New optimization:
# now saving as huffmodel list object
huffmodel_opt <- huff.optim(huffmodel1, location.dataset = huffmod_total2, 
location.id = "j_dest", location.total = "T_j")

huffmodel_opt
# complete huffmodel list object

huffmodel_opt$huffmat
# local market shares
# }

Run the code above in your browser using DataLab