Announcement

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

  • Latitude and Longitude to perform geonear and the case of 90 to -90

    To perform geo near, we require latitude and longitude. For this do we use the coordinates information from the shapefile or create the centroids separately using the centroid command.? Over here I have used the latitudes and longitudes by using the centroid command.

    Second, I am trying to perform geo near. I want to look at the border districts' effect (spillover effect) i.e I want to find the non-treated neighboring districts for my treated districts. However, the treatment of the district varies over time. In other words, districts come in for treatment and go out over time. Now, I have got two datasets with the centroid values - one includes only treated districts and the other non-treated districts. After which I perform the geo near using the following codes with 2000 km?

    geonear district x_stub y_stub using "Non- treated districts with centroids.dta", n(district1 x_stub1 y_stub1) ign long within(2000) near(2)

    However, I am getting the following syntax.

    nbor latitude var x_stub1 must be between -90 and 90
    r(198);

    Can anybody please help with these concerns?

  • #2
    You use the coordinates from the shapefile. But, the fact that your treatment turns on and off presents problems.

    Comment


    • #3
      Latitude -90 to 90 insists that your locations lie somewhere between the North and South Poles with either allowed. Latitude is (must be) measured in degrees following standard geographical convention and it isn't a general word here for any other kind of coordinate. If that's not an answer then I don't understand the question.
      Last edited by Nick Cox; 29 Jan 2022, 06:09.

      Comment


      • #4
        Thanks, Nick.

        I understand what you are saying. My concern is in two folds:
        Firstly, while using the shapefiles to get the coordinates, I have used the command "gencentroids(stub)". Two separate files are generated- one is a coordinate file and the other with the name of the districts, states, and the latitudes and longitudes generated by using the gencentroids(stub) command. So I have used the latitudes and longitudes generated by using the gencentroids(stub) command and not from the coordinate file. For, this I want to double-check if I am doing the right thing?

        My second concern is I want to find the nearby non-treated districts so that I can look at the spillover effect. However, my treatment varies over time (i.e some of the districts come in and go out of the treatment). I have 20 years of panel data with 210 districts. In an attempt to solve this, I have merged the latitudes and the longitudes (generated from shapefile by using the gencentroids(stub) command) with the dataset containing the treatment and year variable by using districts_id- from which I created two files to perform geonear - one with the banned districts and the other with the non-ban districts.

        Now if I try to run geonear using this code

        geonear district x_stub y_stub using "Non- treated districts with centroids.dta", n(district1 x_stub1 y_stub1) ign long within(2000) near(2)

        I am getting the following syntax output
        nbor latitude var x_stub1 must be between -90 and 90.

        I will be very grateful if anyone can help me to solve the above concerns?

        Comment

        Working...
        X