Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

This might be a stretch, but I was wondering if anyone implemented gravity modeling tools or scripts for Retail Market Analysis (like the Huff Model), to analyze spatial data for customer-store relationships?

There are a couple ESRI sources (including Business Analyst extension), but I have not seen any for the open-source world. It seems like a place where PostGIS could really be leveraged for its database qualities.

Reference docs (outdated, but relevant articles explaining the concept):

share|improve this question
    
I don't know of any, but looking through the Directions article and the ArcScript version, the core model doesn't look too onerous to implement, I could imagine you could use GRASS or even something like shapely for a first-cut analysis. –  scw Feb 17 '11 at 6:29
    
As a note it appears discrete choice modelling is very similar to the Huff gravity model and so may be of interest. en.wikipedia.org/wiki/Discrete_choice –  Andy W Feb 17 '11 at 14:25

1 Answer 1

up vote 7 down vote accepted

As scw says in his comment the code itself seems to make use of some basic processing and loops so could probably be rewritten quite quickly in Python and Shapely.

However if you are looking for a script take a look at the following written in R..and German: http://www.reymann.eu/wp-content/uploads/2010/06/GravitationsgesetzHuff.R

Google Translate seems to indicate it provides the "Calculation of the purchase probability Huff's law of gravitation"

Linked to from http://www.reymann.eu/wettbewerbsanalysen/einzugsgebiet

It does have a copyright notice on it so maybe contact the author for further details. If you take out all the lines that print to the screen it seems R can implement it very concisely.

share|improve this answer
1  
In fact, even if there is no copyright notice you should contact the author. Code (and text) is always copyrighted. It could be accompanied by a license or be put in public domain, but then it should clearly say so. –  johanvdw Feb 18 '11 at 11:41
1  
Unfortunately, that script does almost nothing: its input is a (simplistic) Huff model, already formulated and calibrated; all it does is apply it to the distances. –  whuber Mar 21 '11 at 16:18
    
@whuber - as I understand it the Huff formula itself only requires distances from a GIS, the rest is simply a calculation of user entered parameters? –  geographika Mar 22 '11 at 8:47
2  
(1) There is no "Huff's Law of Gravitation." (2) The "Huff formula" specifies a statistical model that requires analysis and calibration to be applied. (3) This model involves estimation of parameters that determine "attractiveness" values for all destinations; it also involves estimation of the rate of decrease of probability (with respect to log distance). A linear trend model for a DEM is analogous: first you have to confirm the DEM is trending, then you use least squares to find its dip and strike. Then you plug these values in. The script merely does the plugging in. –  whuber Mar 22 '11 at 15:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.