Title
spmat dta -- Create an spmat object from a rectangular Stata dataset
Syntax
spmat dta objname varlist [if] [in] [, options]
options Description ------------------------------------------------------------------------- id(varname) variable containing unique IDs idistance convert distance data to inverse distances normalize(norm) normalization method replace replace objname -------------------------------------------------------------------------
Description
spmat dta creates the spmat object objname from a Stata dataset containing the entries of an n x n spatial-weighting matrix. The number of variables in varlist should be equal to the number of observations in the dataset.
Options
id(varname) specifies a variable containing unique place identifiers. If this option is omitted, spmat dta will create the IDs 1, ..., n.
idistance tells spmat that the data are to 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.
Example
Setup . spmat use cobj using pollute.spmat . spmat export cobj using cobj.txt . spmat drop cobj . insheet using cobj.txt, delimiter(" ") clear . rename v1 id
Create the spmat object cobj containing a contiguity matrix stored in the variables v2-v542 . spmat dta cobj v*, id(id) replace
Also see
Online: spmat, spreg, spivreg, spmap, shp2dta, mif2dta (if installed)