+-------+ ----+ Title +------------------------------------------------------------
spcs2xt: Convert Squared Cross Section to Panel Spatial Weight Matrix
+-------------------+ ----+ Table of Contents +------------------------------------------------
Syntax Description Options
*** Examples
Author
+--------+ ----+ 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 Professor (PhD Economics) 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 (2012) SPCS2XT: "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
Online Help:
*** Spatial Econometrics Regression Models:
------------------------------------------------------------------------------- > - *** (1) Spatial Panel Data Regression Models: spregxt Spatial Panel Regression Econometric Models: Stata Module Toolkit gs2slsxt Generalized Spatial Panel 2SLS Regression gs2slsarxt Generalized Spatial Panel Autoregressive 2SLS Regression spglsxt Spatial Panel Autoregressive Generalized Least Squares Regression spgmmxt Spatial Panel Autoregressive Generalized Method of Moments Regress > ion spmstarxt (m-STAR) Spatial Lag Panel Models spmstardxt (m-STAR) Spatial Durbin Panel Models spmstardhxt (m-STAR) Spatial Durbin Multiplicative Heteroscedasticity Panel Mo > dels spmstarhxt (m-STAR) Spatial Lag Multiplicative Heteroscedasticity Panel Model > s spregdhp Spatial Panel Han-Philips Linear Dynamic Regression: Lag & Durbin > Models spregdpd Spatial Panel Arellano-Bond Linear Dynamic Regression: Lag & Durbi > n Models spregfext Spatial Panel Fixed Effects Regression: Lag & Durbin Models spregrext Spatial Panel Random Effects Regression: Lag & Durbin Models spregsacxt MLE Spatial AutoCorrelation Panel Regression (SAC) spregsarxt MLE Spatial Lag Panel Regression (SAR) spregsdmxt MLE Spatial Durbin Panel Regression (SDM) spregsemxt MLE Spatial Error Panel Regression (SEM) ------------------------------------------------------------------------------- > - *** (2) Spatial Cross Section Regression Models: spregcs Spatial Cross Section Regression Econometric Models: Stata Module > Toolkit gs2sls Generalized Spatial 2SLS Cross Sections Regression gs2slsar Generalized Spatial Autoregressive 2SLS Cross Sections Regression gs3sls Generalized Spatial Autoregressive 3SLS Regression gs3slsar Generalized Spatial Autoregressive 3SLS Cross Sections Regression gsp3sls Generalized Spatial 3SLS Cross Sections Regression spautoreg Spatial Cross Section Regression Models spgmm Spatial Autoregressive GMM Cross Sections Regression spmstar (m-STAR) Spatial Lag Cross Sections Models spmstard (m-STAR) Spatial Durbin Cross Sections Models spmstardh (m-STAR) Spatial Durbin Multiplicative Heteroscedasticity Cross Se > ctions Models spmstarh (m-STAR) Spatial Lag Multiplicative Heteroscedasticity Cross Secti > ons Models spregsac MLE Spatial AutoCorrelation Cross Sections Regression (SAC) spregsar MLE Spatial Lag Cross Sections Regression (SAR) spregsdm MLE Spatial Durbin Cross Sections Regression (SDM) spregsem MLE Spatial Error Cross Sections Regression (SEM) ------------------------------------------------------------------------------- > - *** (3) Tobit Spatial Regression Models:
*** (3-1) Tobit Spatial Panel Data Regression Models: sptobitgmmxt Tobit Spatial GMM Panel Regression sptobitmstarxtTobit (m-STAR) Spatial Lag Panel Models sptobitmstardxtTobit (m-STAR) Spatial Durbin Panel Models sptobitmstardhxtTobit (m-STAR) Spatial Durbin Multiplicative Heteroscedasticity > Panel Models sptobitmstarhxtTobit (m-STAR) Spatial Lag Multiplicative Heteroscedasticity Pan > el Models sptobitsacxt Tobit MLE Spatial AutoCorrelation (SAC) Panel Regression sptobitsarxt Tobit MLE Spatial Lag Panel Regression sptobitsdmxt Tobit MLE Spatial Panel Durbin Regression sptobitsemxt Tobit MLE Spatial Error Panel Regression spxttobit Tobit Spatial Panel Autoregressive GLS Regression -------------------------------------------------------------- *** (3-2) Tobit Spatial Cross Section Regression Models: sptobitgmm Tobit Spatial GMM Cross Sections Regression sptobitmstar Tobit (m-STAR) Spatial Lag Cross Sections Models sptobitmstardTobit (m-STAR) Spatial Durbin Cross Sections Models sptobitmstardhTobit (m-STAR) Spatial Durbin Multiplicative Heteroscedasticity C > ross Sections sptobitmstarhTobit (m-STAR) Spatial Lag Multiplicative Heteroscedasticity Cross > Sections sptobitsac Tobit MLE AutoCorrelation (SAC) Cross Sections Regression sptobitsar Tobit MLE Spatial Lag Cross Sections Regression sptobitsdm Tobit MLE Spatial Durbin Cross Sections Regression sptobitsem Tobit MLE Spatial Error Cross Sections Regression ------------------------------------------------------------------------------- > - *** (4) Spatial Weight Matrix: spcs2xt Convert Cross Section to Panel Spatial Weight Matrix spweight Cross Section and Panel Spatial Weight Matrix spweightcs Cross Section Spatial Weight Matrix spweightxt Panel Spatial Weight Matrix ------------------------------------------------------------------------------- > -