Geog 172: Point Pattern Analysis (Lab 4)
Due on November 20, 2019 before 9.30 am
Directions: Please answer all portions of the questions, providing appropriate examples and
evidence as needed. Please label the questions you’re trying to answer. Describe the answers
you get in words as well as provide all your calculations. If you use any symbols in your answer
sheet, please state in words what each symbol stands for, and indicate the units of the answers
wherever applicable. Provide the code used to solve these problems with your answers. Label
the axes of all your figures.
Preliminaries: Download the zipped archives Code.zip and Data.zip from Gauchospace, unzip
them, and add the directories created to Matlab’s path by right clicking on the directories and
selecting: Add to Path -> Selected Folders and Subfolders.
Data: Import the file simEvents.mat into your Matlab workspace as load
simEvents.mat. Type whos to list the contents of your workspace. We will start our
analysis with array evRand, which contains 2 columns with event coordinates.
1. Create some useful variables with the event ids, as well as the event location
coordinates, as: [nEv,nDim] = size(evRand); x = evRand(:,1); y =
evRand(:,2); id = (1:nEv)’. Plot the event locations in space as:
plot(x,y,’k*’); axis equal square;. Now add the rain gauge ids to the
plot as: idChar = num2str(id); text(x,y,idChar); where idChar is a
character array with text, and command num2str converts a number into a character
string.
2. Define the study region from its minimum and maximum x- and y-coordinates as:
BoundBox = [0 100; 0 100]; and compute the coordinates of the square’s
vertices as: CoordsV = boundbox2poly(BoundBox). Define some useful
variables as: nEvents = size(evRand,1); areaD =
polyarea(CoordsV(:,1),CoordsV(:,2)); lambda = nEvents/areaD.
The areaD variable defines the area of your study region and lambda defines your
global density.
3. Compute the index of the nearest neighbor of each event, and the corresponding
distance, as: [idNN,distNN] = knnsearch([x y],[x y],’K’,2). Delete
the 1st columns of both arrays as, for example: idNN(:,1) = []; distNN(:,
1) = []. This is necessary because the function knnsearch returns the two nearest
neighbors where the first column is a distance of 0, i.e., the distance of the point to
itself.
4. Display the nearest neighbor of some event, e.g., event #3, as:
ev2plot = 3; plot(x,y,’*’); hold on;
plot(x(ev2plot),y(ev2plot),’ro’);
plot(x(idNN(ev2plot)),y(idNN(ev2plot)),’go’); hold off;
You can add a line segment connecting event #3 with its nearest neighbor as:
line([x(ev2plot) x(idNN(ev2plot))],[y(ev2plot)
y(idNN(ev2plot))])
What is the length of that line segment denote?
5. Nearest neighbor distance: Compute the observed mean nearest neighbor distance as:
R_0 = mean(distNN);
Now compute the expected value of R, if the pattern is random by:
R_e = 1/(2*sqrt(lambda));
Compute the R statistic as: R = R_0/R_e; How does this value compare to the
expected value of 1? Now compute the z-statistic using:
V = (4 – pi)/(pi*nEvents); Z = (R – 1)/sqrt(V);
Given the computed Z-value, can you reject the null hypothesis that this pattern is
random at a significance level of 5%?
6. Compute the histogram of nearest neighbor distances, as: hist(distNN,20);
where 20 is the number of bins. Also compute the G function for this point pattern as
the Cumulative Distribution Function (CDF) of those distances, as:
cdfplot(distNN); interpret the resulting plots. What is the proportion of events
that lie at most 10 distance units away from their nearest neighbors?
7. When a pattern is random, the G function is given by:
D = 0:0.5:20; G = 1 – exp(-lambda*pi*D.^2);
Compare the expected G function under random pattern with your observations using:
cdfplot(distNN); hold on; plot(D, G, ‘-k’, ‘LineWidth’, 2);
8. Repeat questions 1 to 7 above for the point patterns whose events are stored in array
evClus and evStrat. Compare the results with those you obtained for evRand.
Purchase answer to see full
attachment