CS代考计算机代写 Lab 2: Spatial Statistics

Lab 2: Spatial Statistics
Due at beginning of Lab 3.
Introduction:
Tobler’s Law states “Everything is related to everything else, but near things are more related than distant things”. Spatial Statistics (spatial autocorrelation) is used to evaluate how similar near things are compared to things further away. Metrics including Moran’s I and the Geary Ratio (or Geary’s C) are used all over the world to assess the impact that observations have on other proximate observations.
In this lab, you will be using Moran’s I to evaluate the spatial clustering of farming in Puerto Rico. The software you’ll be using is R.
R and ArcMap have their differences: R is free; R commands are entered at a command-line prompt or from a pre-written program; R can process more data faster; R cartographic tools are very different; and R works on mac and Linux systems.
These software are also similar in some ways: you need to set up a workspace; all of the spatial analysis you can do in ArcMap can be performed in R; and R has packages, which are similar to the ‘Extensions’ model of ArcMap.
Scenario:
Reports suggest that Puerto Rico’s farming industry has been undergoing significant changes during recent years. Geostatistical analysis is required to quantitatively evaluate the status of these changes. Please produce a brief report with figures and an R program that assesses changes in the spatial patterns of farming in Puerto Rico.
Here’s how to get started in R….
Set up your workspace:
Open Rstudio (which is a friendlier user interface than the R console).
Refer to the code I provided for you in the text file (Lab_2-Spatial_Stats.R) to set up your workspace and perform the analysis. Open it up in RStudio and copy lines (in order) to the command-line prompt. Make sure that you include your folder name in the following line, which tells RStudio where to find the required data:
setwd(“D:/Kevin/Brock/Courses/GEOG_3P95/…..”)
GEOG 3P95: Lab 2 Spatial Statistics
1

GEOG 3P95: Lab 2 Spatial Statistics
If you are using a mac for this, the path will have to be something like the following: setwd(“/Users/Your Name/…..”)
The spatial data needed for the lab is located in GEOG3P95>Spatial_Data
Deliverables:
Complete the following in a report-style layout, but use the questions below to guide your writing.
1) Provide a well-written short paragraph that introduces the geostatistical procedures that you are using to investigate spatial patterns in farming in Puerto Rico. Include two maps showing farm density (2002 and 2007). (5 marks)
2) What were the Moran’s I and Geary’s C values for 2007 farm density? Explain what these values indicate for Puerto Rican farm density. (5 marks)
3) Create an R script that includes only the lines necessary to compare LISA cluster maps and Moran scatterplots for 2002 and 2007 farm density. The program should be able to run the analysis and plot the maps and graphs all in one run. Basically, you’ll have to include lines from the R file I provided and add/modify/duplicate some lines to make the plot(s).
Within the program, include in a few words what sections of code are for (e.g., pal.red <- brewer.pal(5,"Reds") # 5 shades of red are saved to pal.red). You can find out what the various tools do by looking at them in the help tool in the bottom right. Include this program in the appendix of your report. Export the plot(s) in an image format (png, or pdf) and add it to your Word document and provide a figure caption. (10 marks – this includes the program, annotation for code, 4-panel plot including two LISA maps and two Moran scatterplots). Notes for question 3: - Open.R file that was provided and save it immediately using another file name so that you can go back to the original version if ever necessary. - Run through the original script you were given one line at a time using the ‘Run’ button o Be sure to focus on what each line is doing (this may be somewhat cryptic, but hopefully you gain a sense of what is going on). - Duplicate the necessary lines into a new block of code and change those new lines to perform the analysis for the other year (2002) of data. 2 GEOG 3P95: Lab 2 Spatial Statistics - Once the program works, run it so that you have a moran scatterplot and LISA map for both 2002 and 2007. o Export these figures as images and add them to your word document. - If you get hung up, try adding individual lines to the command line prompt to see, which line is causing problems. - The aim is to make the program work and produce somewhat great results. Use online resources (Google) to help you figure out how to position and label axes and legends. If you feel you are living a catastrophic nightmare when figuring out the code for a clean layout, you can bring the plots into different software to add the finishing touches (if doing this, you can get rid of your axes labels by adding this to your plot line(s): xlab="", ylab="" ). 4) Provide a brief synthesis of the findings from question 3. For example, what spatial differences in clustering do you see between 2002 and 2007? (5 marks) 5) Export the variogram generated from the lines of code that were provided. Insert this figure into your word document, provide a caption for it and explain what it means. (5 marks) 6) Produce the (2002 and 2007) LISA maps using QGIS. There is a line of code at the bottom of the script provided that exports a shapefile with the ‘quadrant’ class data (e.g., 1 = low-low). Use this field in QGIS to categorize the colours similar to how they looked in the R-generated plots. Put both LISA maps on the same layout and include map elements (scale, title, spatial reference, name, date, labels where necessary, etc.). Comment on the differences between the software (e.g., workflow, accuracy, and your preferences). (5 marks) 7) Explore bringing in precipitation or elevation point data and do some interpolating and/or provide an indication of whether this data has spatial autocorrelation. Get creative and consider what has been discussed in the lectures and covered in the questions above and apply it to this other data. Feel free to use a combination of R and QGIS or whatever software you prefer. (bonus marks). Marking Summary: Questions 1-6 Question 7 Provide answers and associated figures in a word document Explore additional spatial analysis. For example, you could interpolate precipitation data using the rainfall (inches), elevation, and/or temperture data provided in ‘prec_stations.shp’ and ‘temp_stations.shp’ data layers. 35 Bonus (up to 10 marks but totally can not be > 35)
Total
35
3