Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spatial weight matrix

    Dear STATAlist,

    How can I modify an exising weight matrix (queen contiguity of 77 provinces, 539 obs.) with another binary variable (whether it is a downwind product). The downwind variable is created in a separate file in pairwise combination (mun and mun1), removing the duplicate id=id1 of the same province. It has left with 5,852 obs. Although the downwind file contains lat-long variables for each province, I cannot create a neighboring identification to remove the non neighboring pair. So, is it possible to use an existing weight.dta file and integrate the downwind variable ? My ultimate goal is to have a weight matrix of provinces that share borders and are downwind province.

    An exising weight matrix (weight.dta):
    id m1 m2 m3 m4 m5 ..... m77
    1 0 0 0 0 0
    2 0 0 0 0 0
    3 0 0 0 0 0
    4 0 0 0 0 0
    5 0 0 0 0 0
    6 0 0 1 0 0
    7 0 0 0 0 0
    ......
    77 1 0 0 0 0 ...

    A downwind file:

    mun1 mun latitude longitude dist_km angle downwind
    53 1 15.99495 104.7329 506.80356 506.80356 0
    38 1 15.99495 104.7329 1090.5817 1090.5817 0
    10 1 15.99495 104.7329 731.87837 731.87837 0
    8 1 15.99495 104.7329 324.20785 324.20785 0
    32 1 15.99495 104.7329 532.73979 532.73979 0
    15 1 15.99495 104.7329 549.61571 549.61571 0
    74 1 15.99495 104.7329 569.56714 569.56714 0
    63 1 15.99495 104.7329 122.68487 122.68487 1
    36 1 15.99495 104.7329 527.72403 527.72403 0
    14 1 15.99495 104.7329 132.98626 132.98626 1
    18 1 15.99495 104.7329 1065.2679 1065.2679 0
    25 1 15.99495 104.7329 87.973974 87.973974 1
    60 1 15.99495 104.7329 442.69432 442.69432 0
    11 1 15.99495 104.7329 678.89276 678.89276 0
    59 1 15.99495 104.7329 590.88932 590.88932 0

    ......

    I reall appreciate your suggestion,
    VS
Working...
X