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

# Re: st: spmat distance cutoff

 From Ashley Arnio To statalist@hsphsun2.harvard.edu Subject Re: st: spmat distance cutoff Date Tue, 5 Apr 2011 09:37:19 -0700 (PDT)

```Thank you.

----- Original Message ----
From: "rraciborski@stata.com" <rraciborski@stata.com>
To: statalist@hsphsun2.harvard.edu
Sent: Tue, April 5, 2011 12:22:17 PM
Subject: st: spmat distance cutoff

Ashley Arnio <anarnio2@yahoo.com> 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
http://econweb.umd.edu/~prucha/Papers/WP_spmat_2011.pdf.

--Rafal
rraciborski@stata.com
*
*  For searches and help try:
*  http://www.stata.com/help.cgi?search
*  http://www.stata.com/support/statalist/faq
*  http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```