I have a balanced panel data on 41 countries over 39 years. I merged the data with a shapefile and all worked as expected. I also created spatial weighting matrices successfully. However, when I use these matrices in the panel regression estimation using xsmle I get an error indicating that the weighting matrices are not valid. I would greatly appreciate your help.
Blow are summaries from my code.
Code:
spset
Sp dataset: fulldata.dta
Linked shapefile: Africa_shp.dta
Data: Panel
Spatial-unit ID: _ID (equal to iso)
Time ID: year (see xtset)
Coordinates: _CY, _CX (latitude-and-longitude, miles)Code:
preserve keep if year == 2000 spmatrix create contiguity Wc // contiguity spmatrix create idistance Widist // inverse distance restore
Code:
. spmatrix summarize Wc
Weighting matrix Wc
---------------------------------------
Type | contiguity
Normalization | spectral
Dimension | 41 x 41
Elements |
minimum | 0
minimum > 0 | .1856635
mean | .0189971
max | .1856635
Neighbors |
minimum | 1
mean | 4.195122
maximum | 9
---------------------------------------
. spmatrix summarize Widist
Weighting matrix Widist
---------------------------------------
Type | idistance
Normalization | spectral
Dimension | 41 x 41
Elements |
minimum | 0
minimum > 0 | .0062247
mean | .0224497
max | .3301543
---------------------------------------Code:
xsmle y x1 x2 x3 x4 , dlag(3) wmat(Wc) model(sdm) fe dlag(3) effects nolog xsmle y x1 x2 x3 x4 , dlag(3) wmat(Widist) model(sdm) fe dlag(3) effects nolog
Code:
Wc is not a valid spmat object
Code:
Widist is not a valid spmat object
0 Response to xsmle error spatial weighting matrix "is not a valid spmat object"
Post a Comment