[R-sig-eco] Gravity (spatial interaction) models in R

Ben Bolker bolker at zoology.ufl.edu
Tue May 6 18:41:04 CEST 2008


Melanie Murphy wrote:
> Hi All,
>  
> I am constructing "gravity" (spatial interaction) models in R for
> ecological application.  I have linearized the unconstrained model and
> solved using OLS.  However, I would like to do some further, more
> in-depth, analyses.
>  
> 1)     Is there an R package actually designed for gravity models?  I
> have done several searches on the CRAN site with no luck.  My preference
> would be to use R for this manuscript versus commercially available
> software.  
> 2)     I would like to estimate my linearized unconstrained model using
> maximum likelihood.  This may be a simple solution, but I have yet to
> figure out how to do this (my apologies if this is something I should
> have been able to figure out on my own).

    See the mle (stats4) and mle2 (bbmle package on CRAN) functions --
if you can write a function for the (negative log-)likelihood, these 
functions will minimize it and provide wrappers for computing
likelihood ratio tests, profile confidence intervals, etc. etc..

> 3)     For a production (origin) constrained model, I can linearize the
> equation as in the unconstrained model.  The models are similar, accept
> I need to estimate a constant (k) for each origin, but with only one
> estimate of the remaining parameters.  Any ideas on how to
> operationalize this?  I have tried exploring options with multiple
> regression, but am not finding a solution with the appropriate
> mechanics.  This would also be an ML estimate.  

    Don't know quite enough about this to answer, but wouldn't
this just be equivalent to ANCOVA with parallel slopes?
(i.e., something like lm(z~origin+distance), where distance
is distance from (any) source?

> 4)     Any feedback/experience from people who have used gravity models
> in R and/or ecological application would be appreciated.
> 5)     I have tried to keep this posting as brief as possible.  Please
> let me know if you need further information to answer my questions.

    More detail might not hurt for those of us who aren't terribly
familiar with gravity models.  The functions mentioned above
(mle, mle2) are very general, but NOT necessarily efficient
or stable or avoiding multiple minima for particular kinds of complex
problems -- that's why the special-purpose gravity model tools
might work better (if they were available) ...

    Some of the people who work on gravity models in epidemiology
(Bjornstad, Ferrari, et al) use R a lot, but I don't know if they
have developed special-purpose tools.

   Ben Bolker


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-ecology/attachments/20080506/6c8bee31/attachment.bin>


More information about the R-sig-ecology mailing list