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: Updates for nearstat and splagvar available for download

From   "P. Wilner Jeanty" <>
Subject   st: Updates for nearstat and splagvar available for download
Date   Mon, 26 Dec 2011 12:01:49 -0600

Hi All,

Thanks to Kit Baum, new versions for -nearstat- and -splagvar- are
available on SSC. Using Mata, the Stata’s new matrix language,
-nearstat- calculates distances, generates distance-based variables,
and exports the distances to a Stata matrix, a Mata file, or a text
file. To  generate the variables, nearstat performs, for each
observation in a georeferenced Stata dataset, a series of
computational tasks including, but not limited to, calculating
distance-weighted descriptive statistics over all neighbors, nearest
neighbors, and neighbors falling in a specified distance band;
calculating distance to nearest neighbors; counting the number of
neighbors falling in a specified distance band; and determining
whether a specified (e.g., first, second, third,…) nearest neighbor
falls within a certain distance band. Central to the power behind
-nearstat- is a striking Mata function, -minindex()-. Updates include
some fixes (e.g., display format when option des() is specified), an
option to request a variable holding the minimum or maximum distance
from each observation to its neighbors, and an option -iidist()- to
request a variable holding one-to-one distance (i.e., diagonal
elements) when latitudes and longitudes specified in -varlist1- are
different from those specified with the -near()- option.

-splagvar- generates spatially lagged variables of order up to 3,
constructs the Moran scatter plot, and calculates global Moran's I
statistics to test for the presence of spatial dependence in a
variable.  Spatially lagged variables can now be generated for a
specific equation when the equation(#) option is specified.  If
equation(#) option is specified, then -splagvar- form the names of the
spatially lagged variables by prefixing the names of the variables
whose spatial lags were taken with wy#_, wx#_, w2x#_, and w3x#_, where
# stands for the equation number. Otherwise, names are formed by
prefixing  the supplied variable names with wy_, wx_, w2x_, and  w3x_.

To install the new versions type the following command lines and then
restart Stata.

ssc install nearestat, replace
ssc install splagvar, replace

Best wishes,


P. Wilner Jeanty
Rice University
MS 208 6100 Main Street Houston, TX 77005
Phone: (713) 348-3114

*   For searches and help try:

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