Announcement

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

  • Interpolation inverted distance weight

    Hi All!
    Could anyone help me?

    I have monthly data from 2007-2017 with monthly average temperature for 100 stations located in some counties. I have a total of 300 counties. I want to do IDW to calculate the monthly average temperature for all the 300 counties. I want to code this IDW using the three closest stations from each county centroid. And also for the 3 closest up to 50 km.

    I have no idea how to do this with my panel data with 11 years, 12 months each and 300 counties in Stata. Is it possible to do so in Stata?


    Cheers!

  • #2
    I can provide a general idea for what you need to do as I have done similar work looking at hospital distances to universities in counties. However, I believe Matlab or R is better suited for the work.

    Assuming you're working with latitude/longitude coordinates for the centroids and stations, you will use a formula, such as that for great circle distance, to calculate the distance between every centroid and station (it's possible Stata has a function for this, but you can code it manually). This will either be fed into a 100x300 matrix or a 3x30,000 matrix depending on your preference. In the 300*100 matrix every cell corresponds to a single centroid/station pair and contains the distance between the two. In the 3x30,000 matrix each row corresponds to a centroid/station pair with the first two columns identifying the pair and the third containing the distance. Having done this you can identify the 3 closest stations for each centroid and apply whatever inverse function you prefer on the distances.

    A clear description of your dataset set up would help clarify how to do each step. Also see this.

    Comment


    • #3
      Thank you Nate!

      Comment

      Working...
      X