Announcement

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

  • spmatrix Inverse distance matrix with multiple observations in same locations

    I'm working on developing a spatial weight matrix for a dataset of home sales over time. The dataset is not explicitly a time series dataset, it's a panel dataset but it has multiple observations (home sales) at the same location in some instances. This is only for a relatively small subset of the geographic locations represented in the database, most locations only have one transaction. If I define the weight matrix using the spatial location by the property, I get an error "variable _ID does not uniquely identify the observations", while if use the observation number, it gives me the error "Two or more observations have the same coordinates". Since this is based on point locations (not a shapefile), I'm using inverse distance, therefore if multiple transactions have the same location, inverse distance would give an error since we'd be dividing by zero. Without changing this to a panel dataset (this would be messy since it would be so unbalanced), what other options exist for generating a spatial weight matrix with multiple observations at the same location? Is it not possible to assign some arbitrarily large value to observations with the same location for the matrix elements corresponding to the geographical overlap? Thanks in advance for any guidance you can provide!

    code:

    spset obsnum
    spset, modify coord(latitude longitude)
    spset, modify coordsys(latlong, miles)
    spmatrix create idistance Idist

    Two or more observations have the same coordinates

    spset propid
    spset, modify coord(latitude longitude)
    spset, modify coordsys(latlong, miles)
    spmatrix create idistance Idist

    variable _ID does not uniquely identify the observations

  • #2
    There should be no issue with creating the weight matrix, even if you have panel data. The properties remain in the same location over time. However, if two or more properties are assigned the same geographical coordinates, that becomes a problem. You can artificially separate them by adding a small epsilon to their coordinates.

    Comment

    Working...
    X