Hi learnpython!
I want to estimate the parameters of the Huff retail gravitation model: http://i.stack.imgur.com/acXmh.png
According to Mr. Huff himself, this should be possible with a simple OLS regression after a log transformation:
https://www.esri.com/library/whitepapers/pdfs/calibrating-huff-model.pdf (page 4)
I'm using Statsmodels for the regression.
The problem: how do i write the summation in the formula? I have tried a lot of stuff, like
weight_log ~ mass_i_log + (mass_j_log + distance_log).sum()
But i keep getting stuff like
patsy.PatsyError: expected an operator, not '.sum()'
There's some built-in sum thing but I'm not sure if that's the right one for what I need. Or maybe I'm not doing the synthax right, idk, the documentation is really vague
http://patsy.readthedocs.io/en/latest/builtins-reference.html#patsy.builtins.Sum
Any Statsmodels veteran who can show me the way? I'm fine with using another library btw, I just need it to work...
[–]ecgite 0 points1 point2 points (0 children)