


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Objectives:
_1. Practice creating weights matrices in Geoda.
Data:
WestVirginia (shapefile) WV attributes (spreadsheet)
Step 1: Open Geoda and create weights.
Open Geoda from the desktop and open the WestVirginia.shp that we have used in previous exercises. Go to Tools – Weights – Create (or just click on the second „W‟ button along the top). This should bring up a „create weights‟ window. For the input file, select your WestVirginia shapefile. Name your output file WV_weights and save it somewhere that you can access later. Keep the default for the ID variable
Step 2: Create several weights files with different parameters
Name each file differently so you remember what they mean (it may be helpful to note which parameters you use for each file) Contiguity: rook v. queen Order of contiguity: “My neighbor‟s neighbor.” Distance metric: use arc for each file X- and Y- coordinates: keep the defaults for each file Threshold distance: Only includes counties within the threshold (the far right includes all distances) K-Nearest neighbors: Not necessarily symmetric – the number of closest (most similar) neighbors
Figure 1 : Weights files created in Geoda and their naming conventions.
Step 3: Examine each weights file in Geoda.
To see how many neighbors are included in each matrix, go to the 3rd^ „W‟ button (weight characteristics) Load each file you created one by one and examine the graph for each. What are the graphs telling us?
Step 4 : Create a single weights file to use in the exercise.
Create one more weights file using the highest threshold (pull the bar to the far right), so you include all distances Keep arc as the distance metric and the defaults for x- and y- coordinates
Step 4: Open the weights files in Excel.
You can open the weights file that you just created in Excel by importing it (similar to what you did in the chi-square exercise) Once in Excel, the matrix must be further manipulated into a form that you can use. This process is basically just grunt work and would take too much time to do during this exercise, but the method for doing it is listed at the end of the exercise (in the Appendix). If you want to use spatial interaction modeling in your final project, you should hold onto this exercise and use the appendix to do this with your own data.
Step 5: Go to ecampus and download the finished WVCountyDistMatrix. Also open the table (WVAttributes) that you created during the chi-square exercise.
Instead of spending time doing the grunt work, just download the pre-prepared matrix from ecampus and open it in Excel. Also open your WV_attributes table from the last exercise (you‟ll need to copy and paste a few things from that table). From your WV_attributes tables, copy the column „POP2000‟ and paste it into the distance matrix spreadsheet (maybe a column or two past the last column in the distance matrix so you can differentiate it from your matrix, but it doesn‟t really matter where you paste it) – IMPORTANT : Make sure you sort the „POP2000‟ column alphabetically by county before you copy it over to the new table, otherwise it will not be in the correct order! You will also want to create a new matrix below the first one where you can calculate the gravity weight for each pair of counties. The easiest way to do this is to copy the entire matrix and paste it a row or two below the original matrix, then just delete all of the numbers so you are left with just column and row headings. This will give you an open matrix where you can calculate the gravity weights for each pair.
Step 6: Calculate the gravity weight for each pair of counties.
Calculate the gravity weight for each pair of counties by taking the population of the county in the row of the matrix entry, and dividing it by the square of the distance between the two counties. An example of this formula for the Barbour/Berkeley weight is C60=$BF2/(C2^2). The exact cells may differ depending on where you pasted your population column and where your matrix is located in the spreadsheet. The $ sign means that when this formula is copied and pasted, the column in this address stays the same. Since BF is the column my population values ended up in, this is appropriate. Replace everything on the diagonal (the interaction of a county with itself) with zeroes. We‟re going to use these weights to predict the value of each county‟s „pctpoor,‟ so we don‟t want to cheat by using a county‟s value to predict itself. Below your matrix table add a row called „total‟ and sum up the weights from each county column. This sum shows how much interaction each particular county has with all other counties. It should be a different number for each county.
Appendix:
Follow these steps to create a distance matrix from the weight file created in Geoda: