Hello everyone,
I have longitudinal data containing almost 50,000 spatial units which I observe for 11 years. I am trying to run a model with spatial lags of the dependent variable using spxtregress in Stata 15. I would like to create a first-order neighbor contiguity matrix. Given the large number of units and limited computational resources, I can not use the built-in spmatrix create. However, I noticed that spmat runs considerably faster and I have been able to create a weighting matrix object using the following command:
Now, when I try to use the spmat object I get from this as weighting matrix with spxtregress, I get the error weighting matrix Q not found.
The model I am trying to run is of the form
The data is xtset and the spmat object itself seems fine. I suspect that the issue comes from the fact that spxtregress only accepts weighting matrices that were created with spmatrix create.
Is there any workaround that would allow me to use the spmat object as weighting matrix here? I have tried exporting to .txt and reimporting using spmatrix import, but Stata tells me it can't find the .txt file (although it is saved in the correct directory).
Thanks a lot for any advice on this!
I have longitudinal data containing almost 50,000 spatial units which I observe for 11 years. I am trying to run a model with spatial lags of the dependent variable using spxtregress in Stata 15. I would like to create a first-order neighbor contiguity matrix. Given the large number of units and limited computational resources, I can not use the built-in spmatrix create. However, I noticed that spmat runs considerably faster and I have been able to create a weighting matrix object using the following command:
Code:
spmat contiguity Q using Municipalities_EUR_shp.dta if year==18, id(_ID) normalize(row)
The model I am trying to run is of the form
Code:
spxtregress y x1 x2 x3, fe dvarlag(Q)
Is there any workaround that would allow me to use the spmat object as weighting matrix here? I have tried exporting to .txt and reimporting using spmatrix import, but Stata tells me it can't find the .txt file (although it is saved in the correct directory).
Thanks a lot for any advice on this!

Comment