Good afternoon Statalist,
TL:DR - estat moran, errorlag(matrixname) produces an error, "_IDs in weighting matrix Widist do not match _IDs in estimation sample
There are places in Widist not in estimation sample and places in estimation sample not in Widist.", and I am not sure how to solve it.
Further detail:
I am trying to test for spatial auto-correlation in my data using Moran's I. I have followed the steps outlined in Intro 7 in SP manual, including the following:
"_IDs in weighting matrix Widist do not match _IDs in estimation sample
There are places in Widist not in estimation sample and places in estimation sample not in Widist."
I cannot image how this is possible considering the _ID var is generated by STATA, and I merged that variable in from the sp dataset I created. I also did not drop any data until after the merge, and that was only as per the manual's instructions.
Can anyone provide some insight?
Greatfully,
Ben Spoer
TL:DR - estat moran, errorlag(matrixname) produces an error, "_IDs in weighting matrix Widist do not match _IDs in estimation sample
There are places in Widist not in estimation sample and places in estimation sample not in Widist.", and I am not sure how to solve it.
Further detail:
I am trying to test for spatial auto-correlation in my data using Moran's I. I have followed the steps outlined in Intro 7 in SP manual, including the following:
- Download a shape file from the web
- Unzip said shape file and import it into STATA using spshape2dta
- Create a shared ID variable to use to merge into my data
- Open my data set and merge the spatial data into my dataset, used "keep if _merge ==3" to retain only matched records
- Created a spatial weight matrix called Widist using "spmatrix create"
- Ran regress on a few variables of interest
- Attempted to run "estat moran, errorlag(Widist)"
"_IDs in weighting matrix Widist do not match _IDs in estimation sample
There are places in Widist not in estimation sample and places in estimation sample not in Widist."
I cannot image how this is possible considering the _ID var is generated by STATA, and I merged that variable in from the sp dataset I created. I also did not drop any data until after the merge, and that was only as per the manual's instructions.
Can anyone provide some insight?
Greatfully,
Ben Spoer
Comment