model.fit: Goodness of fit statistics for the Huff model

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

This function calculates several goodness of fit values to evaluate how good the observed values fit the empirical observations.

Usage

1
model.fit(y_obs, y_exp, plotVal = FALSE)

Arguments

y_obs

Observed values of the dependent variable y

y_exp

Expected values of the dependent variable y (model results)

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

huff.fit

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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

Example output

$resids_sq_sum
[1] 2.125162e+15

$pseudorsq
[1] 0.5128422

$globerr
[1] 0.5210329

$mape
[1] 0.6383766

[1] 0.6383766

MCI documentation built on May 2, 2019, 6:02 a.m.