help spmat import


spmat import -- Create an spmat object from a text file


spmat import objname using filename [, options]

options Description ------------------------------------------------------------------------- noid filename does not contain unique IDs nlist filename contains a neighbor list geoda filename was created by the GeoDa (TM) software idistance convert distance data to inverse distances normalize(norm) normalization method replace replace objname -------------------------------------------------------------------------


spmat import creates the spmat object objname from the text file filename.

By default, spmat import imports data from a space-delimited text file in which the first line contains the number of columns of the spatial-weighting matrix and, if applicable, the lower and upper band, followed by the matrix stored row-by-row with unique place identifiers recorded in the first column.


noid alerts spmat import that filename does not contain unique place identifiers. If so, Stata will create IDs 1, ..., n.

nlist specifies that the text file is in the neighbor-list format. The first line of the file must contain the total number of places and, if the matrix is banded, the lower and upper band. Each remaining line lists a place ID followed by its neighbors, if any.

geoda specifes that filename is in the .gwt or .gal format created by the GeoDa (TM) software.

idistance tells spmat that the data be converted to inverse distances. The value d will be converted to 1/d with the exception of the main diagonal, which will contain zero entries.

normalize(norm) specifies the normalization method. norm can be row, minmax, or spectral.

replace allows objname to be overwritten if it already exists.


Setup . clear all . set memory 50m . use pollute . spmat contiguity cobj using pollutexy, id(id) normalize(minmax) . spmat export cobj using cobj.txt . spmat drop cobj

Create the spmat object cobj from the file cobj.txt . spmat import cobj using cobj.txt

Also see

Online: spmat, spreg, spivreg, spmap, shp2dta, mif2dta (if installed)