Title
spmat putmatrix -- Put a Mata matrix into an spmat object
Syntax
spmat putmatrix objname [matname] [, options]
options Description ------------------------------------------------------------------------- id(varname|vecname) variable or Mata vector containing unique IDs eig(vecname) Mata vector containing eigenvalues idistance convert distance data to inverse distances normalize(norm) normalization method bands(l u) lower and upper band of matname replace replace objname -------------------------------------------------------------------------
Description
spmat putmatrix puts Mata matrices into an existing spmat object objname, or into a new spmat object, if the specified object does not exist. The optional unique place identifiers can be provided in the id() option in a Mata vector vecname or in a Stata variable varname. If objname does not exist and you do not specify place identifiers, spmat putmatrix will create the IDs 1, ..., n.
Options
id(varname|vecname) specifies a Stata variable or a Mata vector containing unique place identifiers.
eig(vecname) specifies a Mata vector containing the eigenvalues of matname.
idistance specifies to convert the data 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.
bands(l u) specifies the lower and upper band of matname if matname is banded. Neither value can be greater than floor((cols(matname)-1)/4).
replace allows objname to be overwritten if it already exists.
Example
Setup . spmat use cobj using pollute.spmat . spmat getmatrix cobj mymat, id(myid) . spmat drop cobj
Create the spmat object cobj from the Mata matrix mymat and the Mata vector myid . spmat putmatrix cobj mymat, id(myid)
Also see
Online: spmat, spreg, spivreg, spmap, shp2dta, mif2dta (if installed)