Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: spmat distance cutoff

Subject   st: spmat distance cutoff
Date   Tue, 05 Apr 2011 11:22:17 -0500

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:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index