Huff

No preview image

1 collaborator

Default-person Steven Kimbrough (Author)

Tags

market area analysis 

Tagged by Steven Kimbrough over 9 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 5.1.0 • Viewed 405 times • Downloaded 29 times • Run 0 times
Download the 'Huff' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


WHAT IS IT?

A number of establishments that compete for regional customer exist or are contemplated in a particular geographic area. Given the several locations and attractivenesses of these establishments, we would like to predict the market share each will achieve. We are interested in deciding whether to build a number of new establishments as well as where to put any we do decide to build.

This problem falls under the category of market area analysis, addressing one of the category's main concerns: the location of prospective retail stores. The Huff model is used extensively for this purpose. The Huff NetLogo model constitutes a simple implementation of the Huff model.

The basic formula for the Huff model is

P(i,j) = (S(j)alpha / T(i,j)beta) / sum(i=1,n)[(S(j)alpha / T(i,j)beta)]

where

  • P(i,j) is the probability of a consumer at a given origin i traveling to a particular shopping center j.
  • S(i) is the size of a shopping center j (typically measured in terms of the square footage of selling area devoted to the sale of a particular class of goods). More generally, a measure of attractiveness of the shopping center (with higher values more attractive than lower values).
  • T(ij) is the travel time or cost for customer i to go to shopping center j.

  • alpha is a parameter, to be estimated empirically but often simply set to 1, for scaling the importance of the attractiveness measure for the establishment, S(j).

  • beta is a parameter, to be estimated empirically but often simply set to 2 (hence the literature often speaks of the "Huff gravity model" for this class of models), reflecting the effect of travel time and other costs on various kinds of shopping trips.
  • n is the number of establishments or shopping centers under consideration.

Further, it is presumed in using this model that there are m customers, that each customer has a known location, and that each of the establishments under consideration has a known location, real or hypothetical.

The expected traffic for a store j is

expected_traffic(j) = sum(i=1,m)[P(i,j)]

HOW IT WORKS

Customers are represented by turtles and displayed as small gray circles. The setup procedure arrays them randomly. There is nothing in the implementation that makes them move. Stores are represented by patches whose store-at? attributes are set to true. The calculate-store-traffic procedure calculates P(i,j) for all customers i and stores j and reports to the output widget the expected traffic for each store in the model.

HOW TO USE IT

Use the sliders to set the number of customers, n in the Huff formula, and alpha and beta in the Huff formula. Click the setup button to initialize the world. To add stores, click the add-drop-stores button and then click in the world on any patch that does not already have a store. If your click on a patch that already is a store, the store gets removed. Click the add-drop-stores button again when you are done adding or removing stores. Click on the calculate-store traffic to run the Huff formula on each of the customer-store combinations, and to report in the output widget the expected traffic for each store. Stores have a default size of 1 when they are added.

THINGS TO NOTICE

Changing the size of a store can have a substantial affect on the level of its expected traffic, especially if alpha is much greater than 1. You can easily change the size of a store by inspecting it and editing the size attribute.

THINGS TO TRY

You can work interactively with the program to try to find better positions for a given store. You can do this by clicking on the add-drop-stores button, deleting a given store, and adding a new store at a different location. The payoffs resulting from changes in position are often surprising, usually interesting.

You can use NetLogo commands to move the turtles/customers to non-random distributions. For example:

observer> ask turtles [set heading 180]
observer> ask turtles [fd 5]

Again, the payoffs resulting from changes in position are often surprising, usually interesting.

EXTENDING THE MODEL

The Huff Turtles-Based NetLogo model represents a signficant extension to the Huff NetLogo model, as it affords individual and group searches by stores for better positions.

NETLOGO FEATURES

The code uses the NetLogo table extension multiple times in its calculation of P(i,j) and expected traffic.

RELATED MODELS

The coding methods here draw upon the Life NetLogo model, found in the Models Library.

The Huff model has an interesting relationship with Hotelling's spatial location models, which are implemented in the Hotelling's Law NetLogo model in the Models Library.

HOW TO CITE

If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

  • Kimbrough, Steven O. (2014). Huff model. University of Pennsylvania, Philadelphia, PA. Huff.nlogo

COPYRIGHT AND LICENSE

Copyright 2014 Steven O. Kimbrough.

CC BY-NC-SA 3.0

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Steven O. Kimbrough at kimbrough@wharton.upenn.edu.

Version: $Id: Huff.nlogo 4336 2014-09-08 21:12:50Z sok $.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

extensions [table]
globals[background-color the-stores 
  stores-traffic]
patches-own [store-at? store-size ]
turtles-own [store-distances store-probabilities 
  total-distance
  total-attractiveness
  store-attractivenesses]

to setup
  clear-all
  set background-color white
  ask patches [set pcolor background-color
    set store-at? false
    set store-size 1]
  create-turtles customers
  ask turtles [setxy random-xcor random-ycor
    set color gray
    set shape "circle"
    set size 1 / 2]
end 

to add-drop-stores
  let deleting? [store-at?] of patch mouse-xcor mouse-ycor
  while [mouse-down?]
   [ask patch mouse-xcor mouse-ycor
    [ifelse deleting?
      [delete-store]
      [put-store]]
      display
      ]
end 

to delete-store
  ; You can't delete the last store.
  ; But actually, this isn't necessary.
  if count patches with [store-at? = true] > 1
  [set store-at? false
  set pcolor background-color]
end 

to put-store
  set store-at? true
  set pcolor black
end 

to-report get-the-stores
  report patches with [store-at? = true]
end 

to calculate-attractivness-statistics
  let stores get-the-stores
  let n count get-the-stores
  ask turtles [set store-distances []
    set store-probabilities []
    set store-attractivenesses []]  
  ; Record the store distances for each turtle.
  ask turtles [
    let the-turtle self
    ask stores [
      let the-distance distance the-turtle
      let the-store self
      ask the-turtle [set store-distances fput (list the-distance the-store) store-distances]
    ]
  ]
  ; Not really needed:
  ask turtles [set store-distances sort-by [first ?1 < first ?2] store-distances]
  ; Record the store-attractivenesses for each turtle.
  ; The attractiveness of a store is the
  ; product of the size of the store powered
  ; to the value of alpha, times the
  ; reciprocal of 
  ; distance to that store, powered to beta.
  ask turtles [set store-attractivenesses table:make
    set total-distance  total-distances
    let td total-distance    
    foreach store-distances [
     let dist first ?
     let store last ?
     table:put store-attractivenesses (list [pxcor] of store [pycor] of store) 
        ([store-size] of store) ^ alpha * (1 / dist) ^ beta
    ]
  ]
  ; Record the store-probabilities for each turtle.
  ask turtles [set store-probabilities table:make
    set total-attractiveness total-attractivenesses
    foreach table:keys store-attractivenesses [
     table:put store-probabilities ? 
     (table:get store-attractivenesses ? / total-attractivenesses)
     ]
    ]
end 

to-report total-distances
  let answer 0
  foreach store-distances
  [set answer (answer + first ?)]
  report answer
end 

to-report total-attractivenesses
  let answer 0
  foreach table:keys store-attractivenesses
  [set answer (answer + table:get store-attractivenesses ?)]
  report answer  
end 

to calculate-store-traffic
  calculate-attractivness-statistics
  set stores-traffic table:make
  let stores get-the-stores
  ask stores [   let x [pxcor] of self
   let y [pycor] of self
   let key (list x y)
   table:put stores-traffic key 0
  ]
;  set traffic-accumulator 0
  let keys table:keys stores-traffic
  foreach keys [
   ask turtles [table:put stores-traffic ? 
     (table:get stores-traffic ? + table:get store-probabilities ?)
  ]
  ]
  ; Now display it
  clear-output
  output-print (word "Store     Expected")
  output-print (word "Location  Traffic")
  let listtable table:to-list stores-traffic
  set listtable sort-by [last ?1 > last ?2] listtable
  foreach listtable [let address (word first ?)
    let padding ""
    repeat (10 - length address) [set padding (word padding  " ")]
    output-print (word address padding 
      (round (100 * last ?) / 100))]
end 

There is only one version of this model, created over 9 years ago by Steven Kimbrough.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.