+-------+ ----+ Title +------------------------------------------------------------
spcs2xt: Convert Squared Cross Section to Panel Spatial Weight Matrix
+--------+ ----+ Syntax +-----------------------------------------------------------
spcs2xt varlist , panel(numlist) time(numlist) matrix(new_panel_weight_file)
+-------------+ ----+ Description +------------------------------------------------------
spcs2xt creates or generates squared panel spatial weight matrix and file among neighbor locations, from squared Cross Section weight matrix, that already exists in stata dta file, for using in panel spatial regression analysis.
+---------+ ----+ Options +----------------------------------------------------------
time: Number of time series in each cross section (must be balanced).
matrix: Specify name of new panel spatial weight matrix file as stata dta file, that will be created.
+----------+ ----+ Examples +---------------------------------------------------------
clear all
use spcs2xt.dta, clear
db spcs2xt
spcs2xt v1 v2 v3 v4, time(4) matrix(W)
OR USE
spcs2xt v*, time(4) matrix(W)
mat list W
mat list Wxt
The final shape of cross section and panel spatial weight matrix will be as follows:.
-------------------------- | 1 2 3 4 |------------------------- | 0 1 1 1 | 1 0 1 0 | 1 1 0 1 | 1 0 1 0 |-------------------------
(1) (2) (3) (4) |-----------------|-----------------|-----------------|-----------------| (1) | 0 0 0 0 | 1 0 0 0 | 1 0 0 0 | 1 0 0 0 | | 0 0 0 0 | 0 1 0 0 | 0 1 0 0 | 0 1 0 0 | | 0 0 0 0 | 0 0 1 0 | 0 0 1 0 | 0 0 1 0 | | 0 0 0 0 | 0 0 0 1 | 0 0 0 1 | 0 0 0 1 | |-----------------|-----------------|-----------------|-----------------| (2) | 1 0 0 0 | 0 0 0 0 | 1 0 0 0 | 0 0 0 0 | | 0 1 0 0 | 0 0 0 0 | 0 1 0 0 | 0 0 0 0 | | 0 0 1 0 | 0 0 0 0 | 0 0 1 0 | 0 0 0 0 | | 0 0 0 1 | 0 0 0 0 | 0 0 0 1 | 0 0 0 0 | |-----------------|-----------------|-----------------|-----------------| (3) | 1 0 0 0 | 1 0 0 0 | 0 0 0 0 | 1 0 0 0 | | 0 1 0 0 | 0 1 0 0 | 0 0 0 0 | 0 1 0 0 | | 0 0 1 0 | 0 0 1 0 | 0 0 0 0 | 0 0 1 0 | | 0 0 0 1 | 0 0 0 1 | 0 0 0 0 | 0 0 0 1 | |-----------------|-----------------|-----------------|-----------------| (4) | 1 0 0 0 | 0 0 0 0 | 1 0 0 0 | 0 0 0 0 | | 0 1 0 0 | 0 0 0 0 | 0 1 0 0 | 0 0 0 0 | | 0 0 1 0 | 0 0 0 0 | 0 0 1 0 | 0 0 0 0 | | 0 0 0 1 | 0 0 0 0 | 0 0 0 1 | 0 0 0 0 | |-----------------|-----------------|-----------------|------------------
After creating panel spatial weight matrix, you can use spautoreg (if installed) to generate eigenvalues vector and standardized weight matrix.
+--------+ ----+ Author +-----------------------------------------------------------
Emad Abd Elmessih Shehata Assistant Professor Agricultural Research Center - Agricultural Economics Research Institute - Eg > ypt Email: emadstat@hotmail.com WebPage: http://emadstat.110mb.com/stata.htm WebPage at IDEAS: http://ideas.repec.org/f/psh494.html WebPage at EconPapers: http://econpapers.repec.org/RAS/psh494.htm
+------------------+ ----+ spcs2xt Citation +-------------------------------------------------
Shehata, Emad Abd Elmessih (2011) "SPCS2XT: Stata Module to Convert Squared Cross Section to Panel Spatial Weight Matrix"
http://ideas.repec.org/c/boc/bocode/s457348.html
http://econpapers.repec.org/software/bocbocode/s457348.htm
Also see
Online: spautoreg, spautoregxt, spweight, spweightxt, spreg, spivreg, ivreg2, spwmat, spcs2xt, (if installed).