data(Freiburg1)
data(Freiburg2)
data(Freiburg3)
# Loads the data
# NOTE: This may take a while!
# huffmat_total <- huff.attrac(Freiburg1, "district", "store", "salesarea", "distance", lambda = -2,
# dtype= "pow", lambda2 = NULL, Freiburg2, "ppower", Freiburg3, "store", "annualsales",
# output = "total", show_proc = TRUE)
# Local optimization of store attractivity using the function huff.attrac()
# returns a data frame with total values (observed and expected after optimization)
# which is stored into huffmat_total
# model.fit(huffmat_total$total_obs, huffmat_total$sum_E_j)
# returns a list with fit statistics (sum of sq. resid., pseudo-R-squared, global error, mape)
# Results can be adressed directly:
# huff_fit <- model.fit(huffmat_total$total_obs, huffmat_total$sum_E_j)
# huff_fit$mape
Run the code above in your browser using DataLab