huff(huffdataset, origins, locations, attrac, dist, gamma = 1, lambda = -2,
atype = "pow", dtype = "pow", gamma2 = NULL, lambda2 = NULL, output = "shares",
localmarket_dataset = NULL, origin_id = NULL, localmarket = NULL, check_df = TRUE)
data.frame
containing the origins, locations and the explanatory variables
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)
atype = "pow"
(power function), atype = "exp"
(exponential function) or atype = "logistic"
(default: atype = "pow"
)
dtype = "pow"
(power function), dtype = "exp"
(exponential function) or dtype = "logistic"
(default: dtype = "pow"
)
atype = "logistic"
a second \(\gamma\) parameter is needed
dtype = "logistic"
a second \(\lambda\) parameter is needed
output = "shares"
, the Huff function returns an interaction/probability matrix), if output = "total"
, the function returns the total sales of the locations. Default: output = "shares"
output = "total"
, a data.frame
is needed which contains data about the origins
localmarket_dataset
localmarket_dataset
TRUE
)
p_ij
) (if output = "shares"
) or the total sales (sum_E_j
) and total shares (share_j
) of the stores locations (if output = "total"
). Both results are data.frame
.output = "shares"
, the function returns an estimated interaction matrix. If output = "total"
you need local market information about the origins (e.g. purchasing power, population size etc.) filed in another data.frame
and the function results are the total sales/shares of the given stores/locations. Note that each attractivity or distance value must be greater than zero.converse
, reilly
data(Freiburg1)
# Distance matrix for grocery stores in Freiburg
data(Freiburg2)
# Statistical districts of Freiburg
groceryfr <- huff (Freiburg1, "district", "store", "salesarea", "distance", gamma=1, lambda=-2)
# Huff interaction matrix for given grocery stores in Freiburg
# with standard weighting (power function with gamma=1 and lambda=-2)
groceryfr_total <- huff (Freiburg1, "district", "store", "salesarea", "distance",
gamma=1, lambda=-2, localmarket_dataset = Freiburg2, origin_id = "district",
localmarket = "ppower", output="total")
# Calculating total sales of the stores
Run the code above in your browser using DataLab