Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2020-10-31-covid-spatial/index.Rmd typos #1

Open
mark-druffel opened this issue Feb 18, 2021 · 0 comments
Open

2020-10-31-covid-spatial/index.Rmd typos #1

mark-druffel opened this issue Feb 18, 2021 · 0 comments

Comments

@mark-druffel
Copy link

Few typos and slight rewords I saw

#Gloabl Moran's I

We will use the spdep package in R to help perform the Moran’s I test. I prefer working with sf objects in R, which is a newer way to store spatial data-structures that adheres to tidy principals. To take advantage of the robust spatial tests available in spdep, we must use sp objects rather than sf objects. I will convert my sf objects to sp to perform the tests, then tidy the results on the back end using the broom package.

To calculate Moran’s I the spdep function needs to know zip codes' distances from one another. Feeding an sp object to the poly2nb() function will build a neighbors list based on regions sharing the same boundary. Below visually shows the relationships this function is producing.

We are now ready to perform the Moran’s I test for spatial autocorrelation. I used the EBImoran.mc() function since we are working with COVID rates based on the population of a specific zip code. This function also automatically performs Monte Carlo simulations for us to compare our observed test statistic against. We must add the number of COVID cases and population for the zip code, as well as a list of weighted objects representing the neighborhood relationships we calculated earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant