R Spatial Data 2: KNN from Longitude and Latitude

Поділитися
Вставка
  • Опубліковано 21 жов 2024
  • Here I read in some longitude and latitudes, and create a K nearest neighbor weights file. Then we visualize with a plot, and export the weights matrix as a CSV file.
    Link to R Commands: drive.google.c...
    Link to the entire playlist: • Spatial Econometrics (...
    Link to Spatial Econometrics Cheat Sheet: drive.google.c...
    Link to Census Site: www.census.gov...
    Great Circle Distances: • Great Circle Distances...
    My Website: spatial.burkey... or
    www.burkeyacad...
    Support me on Patreon! / burkeyacademy
    Buy me a cup of coffee on PayPal? paypal.me/Burke...
    Talk to me on my SubReddit: / burkeyacademy

КОМЕНТАРІ • 11

  • @lateakaLLA3124
    @lateakaLLA3124 6 років тому

    Thanks for this Video and the file you provided. It works and actually helps me a lot.

  • @berhanebiwotmelese950
    @berhanebiwotmelese950 6 років тому +1

    tank you for your brief and precise description.
    can we do that without shapefile the spatial data???
    In R program the OGR and CRS function it says the message "could not find function "readOGR & CRS" .how can to be solve the error?
    if possible please give me the full commands for spatial data analysis in doc? 10Q 4 all.

    • @BurkeyAcademy
      @BurkeyAcademy  6 років тому

      "Can we do that without shapefile?" Yes, that is what we do in this video.
      "could not find function readOGR" Make sure you have downloaded and activated library "rgdal"
      "give me the full commands in doc?" I am not sure what you want. The commands are linked to, and also there is a link to me cheatsheet in the video description. Let me know what else you need.

    • @berhanebiwotmelese950
      @berhanebiwotmelese950 6 років тому

      hi sir how are you?
      as we discussed in video,I was try to run the function . But when I run " Error in knearneigh(nc.coords, k = 5, LonLat = TRUE) :
      unused argument (LonLat = TRUE)" error messages appear.what is wrong ?
      N.B: sp, rgdal, ape, maptools, foreign, spdep, matrix,spatial are installed.

    • @BurkeyAcademy
      @BurkeyAcademy  6 років тому

      You must type the commands (or copy and paste them from the provided text file linked in the description) EXACTLY as they are provided, with correct spelling and cpitalization. The command is not "LonLat=TRUE", it is "longlat=TRUE".

  • @edgarpadfield1995
    @edgarpadfield1995 4 роки тому

    Is it possible to use KNN to test for clusters on data that is in the form of LSOA and not Long/lat. At the moment I can currently running an analysis on census data

    • @BurkeyAcademy
      @BurkeyAcademy  4 роки тому

      For knn you need some sort of distance measure, since it is determining k Nearest neighbors. In general, I am not a fan of knn unless it is REALLY the best way in your model to define neighbors. I'd suggest trying queen contiguity instead.

    • @edgarpadfield1995
      @edgarpadfield1995 4 роки тому

      @@BurkeyAcademy Thank you, I will give it ago. I have found your videos really helpful!

  • @opa301
    @opa301 4 роки тому

    Thank you so much