Announcement

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

  • Creating group IDs for geospatial event data

    I have a dataset of certain events that I want to analyze based off of location. At the most granular level, for each event point, I have its latitude and longitude. However, I have temperature and precipitation data available at a more macro level (i.e. temp or precipitation points for each 6 square km) that I want to include in the analysis.

    How do I merge the two levels of geolocation available? i.e. how do I make a broader group id that I can assign to clusters of events so that I can merge the temp / precipitation data with the event data? Should I employ GIS?

    Thanks!

  • #2
    I have a "rough and ready" suggestion you might try, which I've used in a similar context. I'm presuming that your temp/precip file has a lat/long for each 6 km2 region, presumably its centroid. Given that, you can use -geonear- (-ssc describe geonear-) to find the (say) five closest temp/precip regions ("neighbors") for each event, and put their ids and distances onto the event observations. You can then use -merge- to put the temp and precip variables for each of the neighbors onto each event observation. Using those five measures, you can can calculate some sort of average (e.g., an inverse-distance-weighted mean) of the neighbors' temp and precip measures for each event. The relevant code would look something like this, taking into account that the following is untested and might have syntax errors:

    Code:
    geonear idevent latitutde longitude using tempprecip.dta, ///
       wide neighbors(idtempprecip, latitude, longitude) nearcount(5) genstub(nay)
    foreach id of varlist nay_id* {
       merge m:1 `id' using idtempprecip.dta, keep(match)
     }
    // do weighted mean here

    Comment


    • #3
      One correction: To make the merge work, you'd need to make "idevent" and the various "nay_id*" have the same name.

      Comment


      • #4
        Thanks for your help Mike, it worked wonderfully.

        Comment

        Working...
        X