SPWMATRIX: Stata module to generate, import, and export spatial weights

spwmatrix creates distance-based spatial weights and imports adjacency-based weights (gal files saved in sparse format) created in the GeoDa software (See http://geodacenter.asu.edu":http://geodacenter.asu.edu). spwmatrix also generates economic distance spatial weights based on an economic variable (See Fingleton and Le Gallo, 2008), and social network and socio-economic spatial based on a social variable (See Anselin and Bera, 1998). Created or imported spatial weights and their eigenvalues are generated as temporary Stata matrices or permanent Mata files. spwmatrix also exports the generated spatial weights to a .dat file for use in Matlab or to a .gwt file for use in GeoDa. When creating spatial weights, spwmatrix uses either the straight-line (crow-fly) Euclidean distance or the Great Circle distance depending on whether the latitudes and longitudes supplied in varlist are projected or not.