Chapter 16 Activity 7: Point Pattern Analysis IV
NOTE: The source files for this book are available with companion package {isdas}. The source files are in Rmarkdown format and packed as templates. These files allow you execute code within the notebook, so that you can work interactively with the notes.
16.1 Practice questions
Answer the following questions:
- What does the \(\hat{G}\)-function measure?
- What does the \(\hat{F}\)-function measure?
- How do these two functions relate to one another?
- Describe the intuition behind the \(\hat{K}\)-function.
- How does the \(\hat{K}\)-function capture patterns at multiple scales?
16.2 Learning objectives
In this activity, you will:
- Explore a dataset using single scale distance-based techniques.
- Explore the characteristics of a point pattern at multiple scales.
- Discuss ways to evaluate how confident you are that a pattern is random.
16.3 Suggested reading
O’Sullivan D and Unwin D (2010) Geographic Information Analysis, 2nd Edition, Chapter 5. John Wiley & Sons: New Jersey.
16.4 Preliminaries
It is good practice to begin with a clean session to make sure that you do not have extraneous items there when you begin your work. The best practice is to restart the R
session, which can be accomplished for example with command/ctrl + shift + F10
. An alternative to only purge user-created objects from memory is to use the R
command rm
(for “remove”), followed by a list of items to be removed. To clear the workspace from all objects, do the following:
Note that ls()
lists all objects currently on the workspace.
Load the libraries you will use in this activity. In addition to tidyverse
, you will need spatstat
, a package designed for the analysis of point patterns (you can learn about spatstat
here and here):
library(isdas) # Companion Package for Book An Introduction to Spatial Data Analysis and Statistics
library(sf) # Simple Features for R
library(spatstat) # Spatial Point Pattern Analysis, Model-Fitting, Simulation, Tests
library(tidyverse) # Easily Install and Load the 'Tidyverse'
For this activity, you will use the same datasets that you used in Activity 6, including the geospatial files for Toronto’s city boundary:
Convert the sf
object to an owin
object (via SpatialPolygons
, hence as(x, "Spatial")
:
Next, load the data that you will use in this activity. Each dataframe is converted into a ppp
object using the as.ppp
function, again after extracting the coordinates of the events from the sf
object:
data("Fast_Food")
Fast_Food.ppp <- as.ppp(st_coordinates(Fast_Food), W = Toronto.owin)
# Add the classes of fast food to the ppp object:
marks(Fast_Food.ppp) <- Fast_Food$Class
data("Gas_Stands")
Gas_Stands.ppp <- as.ppp(st_coordinates(Gas_Stands), W = Toronto.owin)
data("Paez_Mart")
Paez_Mart.ppp <- as.ppp(st_coordinates(Paez_Mart), W = Toronto.owin)
Now that you have the data sets in the appropriate format, you are ready for the next activity.
16.5 Activity
NOTE: Activities include technical “how to” tasks/questions. Usually, these ask you to practice using the software to organize data, create plots, and so on in support of analysis and interpretation. The second type of questions ask you to activate your brainware and to think geographically and statistically.
Activity Part I
Plot the empirical \(\hat{F}\)-function for all fast food establishments (pooled) and then for each type of establishment separately (i.e, “Chicken”, “Hamburger”, “Pizza”, “Sub”).
Plot the empirical \(\hat{K}\)-function for all fast food establishments (pooled) and then for each type of establishment (i.e, “Chicken”, “Hamburger”, “Pizza”, “Sub”).
Activity Part II
Discuss your results with a fellow student. Is there evidence of clustering/regularity?
What can you say about patterns at multiple-scales based on the graphs above?
How confident are you to make a decision whether the patterns are not random? What could you do to assess your confidence in making a decision whether the patterns are random? Explain.