Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: spmat distance cutoff

From   Ashley Arnio <>
Subject   Re: st: spmat distance cutoff
Date   Tue, 5 Apr 2011 09:37:19 -0700 (PDT)

Thank you. 

----- Original Message ----
From: "" <>
Sent: Tue, April 5, 2011 12:22:17 PM
Subject: st: spmat distance cutoff

Ashley Arnio <> has a question about using a distance cutoff
when creating an inverse-distance spatial-weighting matrix:

> Is there a way to use a "distance cutoff" of 100 miles, for example, in the 
> inverse distance matrix with an alpha of 2 using the spmat command? 

-spmat idistance- provides the -vtruncate()- option that works as a distance
cutoff.  I will illustrate with the ancillary pollute.dta dataset that comes
with the sppack suite.

  . use pollute, clear
  . spmat idistance dobj longitude latitude, id(id) ///
      dfunction(dhaversine, miles) vtruncate(1/100)

Since the distances are on an inverse scale, I specified 1/100 rather than 100
to be the cutoff value.  -vtruncate(1/100)- caused -spmat idistance- to set the
weights of neighbors of each spatial unit to zero if they lie 100 or more
miles from a given unit.  I also specified -miles- in -dfunction()- as the
default is to calculate distances in kilometers.

The truncation options are described in section 3.2 and illustrated in
section 3.6 of the working paper 'Creating and managing spatial-weighting
matrices using the spmat command', available at

*  For searches and help try:

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index