Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Gravity Model ML estimation

From   "Nick Cox" <>
To   <>
Subject   st: RE: Gravity Model ML estimation
Date   Mon, 2 Dec 2002 19:52:56 -0000

Julia A Gamas Buentello
>  Does anybody have a subroutine that will solve the 
> following problem?:
>  I have a gravity model of the form:
>  Tij = Ai *Oi* Bj* Dj * (d to the minus beta), where
> Ai = Sumation over i of [Bj* Dj * (d to the minus beta)]
> and
>  Bj = Summation over j of [Ai Oi * (d to the minus beta)]
>  The purpose is to find beta using non-linear maximum 
> likelihood.  The Ai
> and Bj are balancing factors that "guarantee" that two 
> constraints are met.
> I want to estimate it using maximum likelihood.  The 
> procedure is to start
> with a beta=1, then use it to iterate Ai and Bj until Ai 
> and Bj no longer
> change, then to go back and check that a constraint 
> equation is met.  The
> constraint equation is:
>  estimated sum over i and j of Tij ln(dij) = the "real" sum 
> over i and j of
> Tij ln(dij)
> Does Stata have a subroutine that already does this?  I am 
> hoping to save
> some graduate student hours and not have to write up the 
> program from
> scratch.

I guess the short answer is No. 

For those curious about what all this means, 
the idea is that fluxes T_ij (say of people 
or of goods or of information) between places 
i and j in some region are deemed to be driven by characteristics 
of origins O_i, of destinations D_j, and 
of the distances d_ij between them. The 
distance function here is one particular choice. 

The term "gravity model" here is a historical 
misnomer based on the fact that some models before 
this one, which emerged in the late 1960s, 
used a closer analogue of Newtonian gravitation 
in which interaction between places was held 
to be similar to attraction between masses and
so governed by an inverse-square law. Of course, 
as every traveller knows, distance between 
places, however defined, is not the only measure
of the difficulty of interaction. 

This is all equivalent to an entropy-minimising 
approach based on statistical mechanics. There is 
Fortran code in R.S. Baxter's 1976 book which implements 
that, and I imagine that it would be less work 
to translate that into Stata than to try 
to set this up in Stata as a ML problem, unless 
you particularly want the side results of that as 
well as the parameter estimates. Or, of 
course, Fortran compilers continue to exist. 

*   For searches and help try:

© Copyright 1996–2023 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index