model.fit {MCI} | R Documentation |
Goodness of fit statistics for the Huff model
Description
This function calculates several goodness of fit values to evaluate how good the observed values fit the empirical observations.
Usage
model.fit(y_obs, y_exp, plotVal = FALSE)
Arguments
y_obs |
Observed values of the dependent variable |
y_exp |
Expected values of the dependent variable |
plotVal |
Logical argument that indicates if the function plots a graph comparing observed and expected values |
Details
This function computes several goodness of fit statistics to evaluate the results of non-linear fitting procedures for the Huff model (see the functions huff.attrac
and huff.fit
). 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).
Value
list:
resids_sq_sum |
Sum of squared residuals |
pseudorsq |
Pseudo-R-squared |
globerr |
Global error |
mape |
Mean average percentage error |
Author(s)
Thomas Wieland
References
De Beule, M./Van den Poel, D./Van de Weghe, N. (2014): “An extended Huff-model for robustly benchmarking and predicting retail network performance”. In: Applied Geography, 46, 1, p. 80-89.
Klein, R. (1988): “Der Lebensmittel-Einzelhandel im Raum Verden. Raeumliches Einkaufsverhalten unter sich wandelnden Bedingungen”. Flensburger Arbeitspapiere zur Landeskunde und Raumordnung, 6. Flensburg.
See Also
Examples
# Controlling the fit of a Huff Model market area estimation #
data(Freiburg1)
data(Freiburg2)
data(Freiburg3)
# Loads the data
huff_mat <- huff.shares (Freiburg1, "district", "store", "salesarea", "distance")
# Market area estimation using the Huff Model with standard parameters
# (gamma = 1, lambda = -2)
huff_mat_pp <- merge (huff_mat, Freiburg2)
# Adding the purchasing power data for the city districts
huff_total <- shares.total (huff_mat_pp, "district", "store", "p_ij", "ppower")
# Total expected sales and shares
huff_total_control <- merge (huff_total, Freiburg3, by.x = "suppliers_single",
by.y = "store")
model.fit(huff_total_control$annualsales, huff_total_control$sum_E_j, plotVal = TRUE)
# Observed vs. expected
# Results can be adressed directly:
huff_fit <- model.fit(huff_total_control$annualsales, huff_total_control$sum_E_j, plotVal = TRUE)
huff_fit$mape