Dear all,
Similar to Dario's problem at the top but with respect to panel data I would like to use the user written spwmatrix routine to generate a spatial matrix choosing the k nearest neighbours. Since I would like to eventually run the spxtregress command I nee to crosswalk from spwmatrix to spmatrix. To do so I tried to manipulate Rafal's code from above a bit:
spwmatrix gecon _CY _CX if year==2000, wn(myW) knn(5) mata: W = st_matrix("W") mata: id = 1::cols(W) spmatrix spfrommata spW = W id spmatrix summarize spW
BUT I receive the following error message after typing: spxtregress y x1 x2 x3, fe dvarlag(spW)
(1719 observations)
(1719 observations used)
(data contain 191 panels (places) )
(weighting matrix defines 191 places)
_IDs in weighting matrix spW do not match _IDs in estimation sample
There are places in spW not in estimation sample and places in estimation sample not in spW.
I would be grateful if someone could give me an idea in order to make this work Perhaps you, Rafal?
Best regards
Similar to Dario's problem at the top but with respect to panel data I would like to use the user written spwmatrix routine to generate a spatial matrix choosing the k nearest neighbours. Since I would like to eventually run the spxtregress command I nee to crosswalk from spwmatrix to spmatrix. To do so I tried to manipulate Rafal's code from above a bit:
spwmatrix gecon _CY _CX if year==2000, wn(myW) knn(5) mata: W = st_matrix("W") mata: id = 1::cols(W) spmatrix spfrommata spW = W id spmatrix summarize spW
BUT I receive the following error message after typing: spxtregress y x1 x2 x3, fe dvarlag(spW)
(1719 observations)
(1719 observations used)
(data contain 191 panels (places) )
(weighting matrix defines 191 places)
_IDs in weighting matrix spW do not match _IDs in estimation sample
There are places in spW not in estimation sample and places in estimation sample not in spW.
I would be grateful if someone could give me an idea in order to make this work Perhaps you, Rafal?
Best regards
Comment