EconPapers    
Economics at your fingertips  
 

NEARSTAT: Stata module to calculate distance-based variables and export distance matrix to text file

P. Wilner Jeanty ()

Statistical Software Components from Boston College Department of Economics

Abstract: Using Mata, 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 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. Distance is calculated as the Great Circle or crow-fly distance depending on whether spherical or Cartesian coordinates are supplied to nearstat.

Language: Stata
Requires: Stata version 10.1
Keywords: spatial data; nearest neighbors; Great Circle distance; spherical coordinates (search for similar items in EconPapers)
Date: 2010-01-26, Revised 2012-02-07
Note: This module should be installed from within Stata by typing "ssc install nearstat". The module is made available under terms of the GPL v3 (https://www.gnu.org/licenses/gpl-3.0.txt). Windows users should not attempt to download these files with a web browser.
References: Add references at CitEc
Citations: View citations in EconPapers (5)

Downloads: (external link)
http://fmwww.bc.edu/repec/bocode/n/nearstat.ado program code (text/plain)
http://fmwww.bc.edu/repec/bocode/n/nearstat.mata program code (text/plain)
http://fmwww.bc.edu/repec/bocode/l/lnearstat.mlib Mata object library (application/x-stata)
http://fmwww.bc.edu/repec/bocode/n/nearstat.sthlp help file (text/plain)

Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.

Export reference: BibTeX RIS (EndNote, ProCite, RefMan) HTML/Text

Persistent link: https://EconPapers.repec.org/RePEc:boc:bocode:s457110

Ordering information: This software item can be ordered from
http://repec.org/docs/ssc.php

Access Statistics for this software item

More software in Statistical Software Components from Boston College Department of Economics Boston College, 140 Commonwealth Avenue, Chestnut Hill MA 02467 USA. Contact information at EDIRC.
Bibliographic data for series maintained by Christopher F Baum ().

 
Page updated 2025-03-30
Handle: RePEc:boc:bocode:s457110