Announcement

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

  • How to Include Neighborhood Effects for Natural Disasters in Stata?

    Hi everyone,

    I am working with firm-bank-county-level monthly data and analyzing the effect of natural disasters on bank loans. Specifically, I want to include neighborhood effects to account for the impact of disasters in nearby areas. For this, I need to generate two variables based on FEMA-declared disasters:
    1. fema_border: This variable should equal 1 if a disaster occurs in any county that shares a common border with the focal county, otherwise 0.
    2. fema_distance: This variable should equal 1 if a disaster occurs within 1000 km of the focal county, otherwise 0.
    My dataset includes the following:
    • County identifiers (county_id).
    • Latitude and longitude for each county.
    • A binary variable (fema_disaster) indicating if a FEMA-declared disaster occurred in a county for a given month.
    I am looking for advice on how to generate these two variables in Stata. Specifically:
    • How can I identify counties that share a border?
    • What’s the best way to calculate distances between counties and flag those within 1000 km of a disaster?
    I’ve read about the geodist command for calculating distances, but I’m not sure how to approach the broader task, particularly identifying bordering counties. Any tips, code snippets, or references to similar problems would be greatly appreciated!

    A sample database is as follows:

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input int tm float(firm_bank_county latitude longitude) byte statefips long countyfips byte fema
    450  1  42.64758 -83.28208 26 26125 1
    450  2  42.64758 -83.28208 26 26125 1
    513  2  42.64758 -83.28208 26 26125 0
    450  3  42.64758 -83.28208 26 26125 1
    513  3  42.64758 -83.28208 26 26125 0
    450  4  42.64758 -83.28208 26 26125 1
    450  5  42.64758 -83.28208 26 26125 1
    450  6  42.64758 -83.28208 26 26125 1
    513  7  42.64758 -83.28208 26 26125 0
    513  8  42.64758 -83.28208 26 26125 0
    450  9  42.64758 -83.28208 26 26125 1
    450 10  42.64758 -83.28208 26 26125 1
    450 11  42.64758 -83.28208 26 26125 1
    513 12  42.64758 -83.28208 26 26125 0
    513 13  42.64758 -83.28208 26 26125 0
    513 14  42.64758 -83.28208 26 26125 0
    527 15 37.970825 -87.48482 18 18163 0
    471 16 37.970825 -87.48482 18 18163 0
    456 17 37.970825 -87.48482 18 18163 0
    682 17 37.970825 -87.48482 18 18163 0
    540 24 37.970825 -87.48482 18 18163 1
    597 24 37.970825 -87.48482 18 18163 0
    456 25 37.970825 -87.48482 18 18163 0
    471 25 37.970825 -87.48482 18 18163 0
    471 26 37.970825 -87.48482 18 18163 0
    588 26 37.970825 -87.48482 18 18163 1
    471 27 37.970825 -87.48482 18 18163 0
    743 31 37.970825 -87.48482 18 18163 0
    743 32   42.4262 -83.37474 26 26163 0
    606 33 37.970825 -87.48482 18 18163 0
    471 34 37.970825 -87.48482 18 18163 0
    456 35 37.970825 -87.48482 18 18163 0
    606 36 37.970825 -87.48482 18 18163 0
    456 37 37.970825 -87.48482 18 18163 0
    471 48 37.970825 -87.48482 18 18163 0
    521 49 37.970825 -87.48482 18 18163 0
    540 49 37.970825 -87.48482 18 18163 1
    574 49 37.970825 -87.48482 18 18163 0
    527 50 37.970825 -87.48482 18 18163 0
    527 51 37.970825 -87.48482 18 18163 0
    end
    format %tm tm

    Best regards,
    Woahid

  • #2
    HTML Code:
    https://www.census.gov/geographies/reference-files/time-series/geo/county-adjacency.html
    geonear

    Comment

    Working...
    X