The XploRe library spatial provides access to the following
quantlets for spatial point process analysis:
SPPPinit,
SPPPinitrandom,
SPPPsetregion,
SPPPgetregion,
SPPPkfn,
SPPPpsim,
SPPPstrauss,
SPPPssi,
SPPPkenvl, and
SPPPkaver.
The examples in this Section show how to do the computations and produce the graphics from Section 14.3, i.e., Figure 14.9, in Venables and Ripley (1999), using XploRe.
After initializing the pines.dat data set, we first draw the raw data in the upper left plot:
library ("spatial") pines = read ("pines.dat") ; pinesobj = SPPPinit (pines, 0, 96, 0, 100, 10) ; spkfn = SPPPkfn (pinesobj, 5, 100) ; ; Figure 14.9 ; dd = createdisplay (3, 3) ; ; Upper left plot ; xydat = pinesobj.pp setmaskp (xydat, 4, 5, 8) show (dd, 1, 1, xydat) setheadline (dd, 1, 1, "Pines Data")
We now make 100 simulation runs of a Binomial process
with 72 observations that inhibit the same spatial domain
as the original data. We draw the result of the first simulation run
in the upper center plot
and the envelope of L(t) of these simulation runs in the upper
right plot. Here,
,
where K represents Ripley's K function.
For a Poisson process
,
thus L(t) will be linear
for a Poisson process. The solid black line is L(t) for the
pines.dat data set.
Obviously, a Binomial process does not fit the pines.dat data set.
; ; Upper plots calculations ; SPPPinitrandom (0) sppsim = SPPPpsim (100, 72) spkenvl = SPPPkenvl (5, 100, sppsim) ; ; ; Upper center plot ; xydat = sppsim.xmat[,1] ~ sppsim.ymat[,1] setmaskp (xydat, 4, 5, 8) show (dd, 1, 2, xydat) setheadline (dd, 1, 2, "Psim (72) - 1 Run") ; ; ; Upper right plot ; linedat2 = spkenvl.hx ~ spkenvl.hl setmaskp (linedat2, 0, 0, 0) setmaskl (linedat2, (1:99) ~ (2:100), 1, 2, 2) show (dd, 1, 3, linedat2) ; linedat3 = spkenvl.hx ~ spkenvl.hu setmaskp (linedat3, 0, 0, 0) setmaskl (linedat3, (1:99) ~ (2:100), 1, 2, 2) adddata (dd, 1, 3, linedat3) ; linedat4 = spkenvl.hx ~ spkenvl.aver setmaskp (linedat4, 0, 0, 0) setmaskl (linedat4, (1:99) ~ (2:100), 3, 2, 2) adddata (dd, 1, 3, linedat4) ; linedat = spkfn.x ~ spkfn.y setmaskp (linedat, 0, 0, 0) setmaskl (linedat, (1:99) ~ (2:100), 0, 1, 2) adddata (dd, 1, 3, linedat) setheadline (dd, 1, 3, "Psim (72) Envelopes") setgopt (dd, 1, 3, "xlabel", "Distance", "ylabel", "L(t)")
In the middle plots, we consider a Strauss process as a possible alternative. The middle left plot shows a one run of a Strauss(72, 0.15, 0.7) simulation. In the middle center plot, we draw the envelope of L(t) of 100 of these simulation runs. The solid black line is L(t) for the pines.dat data set. The solid cyan lines represents the averages of the simulation runs.
In addition, we also conduct 100 simulation runs of a Strauss(72, 0.2, 0.7) process. Similarly, we draw the envelope of L(t) of these simulation runs, the averages, and the result from the pines.dat data set. Obviously, both processes describe the data reasonably well.
; ; Center plots calculations ; SPPPinitrandom (0) spstrauss1 = SPPPstrauss (100, 72, 0.15, 0.7) spkenvl = SPPPkenvl (1.5, 100, spstrauss1) ; ; ; Center left plot ; xydat = spstrauss1.xmat[,1] ~ spstrauss1.ymat[,1] setmaskp (xydat, 4, 5, 8) show (dd, 2, 1, xydat) setheadline (dd, 2, 1, "Strauss (72, 0.15, 0.7) - 1 Run") ; ; ; Center center plot ; linedat2 = spkenvl.hx ~ spkenvl.hl setmaskp (linedat2, 0, 0, 0) setmaskl (linedat2, (1:99) ~ (2:100), 1, 2, 2) show (dd, 2, 2, linedat2) ; linedat3 = spkenvl.hx ~ spkenvl.hu setmaskp (linedat3, 0, 0, 0) setmaskl (linedat3, (1:99) ~ (2:100), 1, 2, 2) adddata (dd, 2, 2, linedat3) ; linedat4 = spkenvl.hx ~ spkenvl.aver setmaskp (linedat4, 0, 0, 0) setmaskl (linedat4, (1:99) ~ (2:100), 3, 2, 2) adddata (dd, 2, 2, linedat4) ; linedat = paf(spkfn.x ~ spkfn.y, spkfn.x <= 1.5) setmaskp (linedat, 0, 0, 0) setmaskl (linedat, (1:29) ~ (2:30), 0, 1, 2) adddata (dd, 2, 2, linedat) setheadline (dd, 2, 2, "Strauss (72, 0.15, 0.7) - Envelopes") setgopt (dd, 2, 2, "xlabel", "Distance", "ylabel", "L(t)") ; ; ; Center right plot ; spstrauss2 = SPPPstrauss (100, 72, 0.2, 0.7) spkenvl = SPPPkenvl (1.5, 100, spstrauss2) ; ; linedat2 = spkenvl.hx ~ spkenvl.hl setmaskp (linedat2, 0, 0, 0) setmaskl (linedat2, (1:99) ~ (2:100), 1, 2, 2) show (dd, 2, 3, linedat2) ; linedat3 = spkenvl.hx ~ spkenvl.hu setmaskp (linedat3, 0, 0, 0) setmaskl (linedat3, (1:99) ~ (2:100), 1, 2, 2) adddata (dd, 2, 3, linedat3) ; linedat4 = spkenvl.hx ~ spkenvl.aver setmaskp (linedat4, 0, 0, 0) setmaskl (linedat4, (1:99) ~ (2:100), 3, 2, 2) adddata (dd, 2, 3, linedat4) ; linedat = paf(spkfn.x ~ spkfn.y, spkfn.x <= 1.5) setmaskp (linedat, 0, 0, 0) setmaskl (linedat, (1:29) ~ (2:30), 0, 1, 2) adddata (dd, 2, 3, linedat) setheadline (dd, 2, 3, "Strauss (72, 0.2, 0.7) - Envelopes") setgopt (dd, 2, 3, "xlabel", "Distance", "ylabel", "L(t)")
Just for illustrative purposes, we also look at 100 simulation runs of Matern's sequential spatial inhibition (SSI) process in the bottom row. The result of the first simulation run are displayed in the lower left plot. The lower center and lower right plots display the envelope of L(t) of 100 of these simulation runs. The solid black line is L(t) for the pines.dat data set. The solid cyan lines represents the averages of the simulation runs.
Obviously, we this SSI(72, 0.7) does not fit the pines.dat data set.
; ; Lower plots calculations ; SPPPinitrandom (0) spssi = SPPPssi (100, 72, 0.7) spkenvl1 = SPPPkenvl (1.5, 100, spssi) spkenvl2 = SPPPkenvl (5, 100, spssi) ; ; ; Lower left plot ; xydat = spssi.xmat[,1] ~ spssi.ymat[,1] setmaskp (xydat, 4, 5, 8) show (dd, 3, 1, xydat) setheadline (dd, 3, 1, "SSI (72, 0.7) - 1 Run") ; ; ; Lower center plot ; linedat2 = spkenvl1.hx ~ spkenvl1.hl setmaskp (linedat2, 0, 0, 0) setmaskl (linedat2, (1:99) ~ (2:100), 1, 2, 2) show (dd, 3, 2, linedat2) ; linedat3 = spkenvl1.hx ~ spkenvl1.hu setmaskp (linedat3, 0, 0, 0) setmaskl (linedat3, (1:99) ~ (2:100), 1, 2, 2) adddata (dd, 3, 2, linedat3) ; linedat4 = spkenvl1.hx ~ spkenvl1.aver setmaskp (linedat4, 0, 0, 0) setmaskl (linedat4, (1:99) ~ (2:100), 3, 2, 2) adddata (dd, 3, 2, linedat4) ; linedat = paf(spkfn.x ~ spkfn.y, spkfn.x <= 1.5) setmaskp (linedat, 0, 0, 0) setmaskl (linedat, (1:29) ~ (2:30), 0, 1, 2) adddata (dd, 3, 2, linedat) setheadline (dd, 3, 2, "SSI (72, 0.7) - Envelopes") setgopt (dd, 3, 2, "xlabel", "Distance", "ylabel", "L(t)") ; ; ; Lower right plot ; linedat2 = spkenvl2.hx ~ spkenvl2.hl setmaskp (linedat2, 0, 0, 0) setmaskl (linedat2, (1:99) ~ (2:100), 1, 2, 2) show (dd, 3, 3, linedat2) ; linedat3 = spkenvl2.hx ~ spkenvl2.hu setmaskp (linedat3, 0, 0, 0) setmaskl (linedat3, (1:99) ~ (2:100), 1, 2, 2) adddata (dd, 3, 3, linedat3) ; linedat4 = spkenvl2.hx ~ spkenvl2.aver setmaskp (linedat4, 0, 0, 0) setmaskl (linedat4, (1:99) ~ (2:100), 3, 2, 2) adddata (dd, 3, 3, linedat4) ; linedat = spkfn.x ~ spkfn.y setmaskp (linedat, 0, 0, 0) setmaskl (linedat, (1:99) ~ (2:100), 0, 1, 2) adddata (dd, 3, 3, linedat) setheadline (dd, 3, 3, "SSI (72, 0.7) - Envelopes") setgopt (dd, 3, 3, "xlabel", "Distance", "ylabel", "L(t)")
And here is the result of all these plots:
This concludes the tutorial on XploRe's spatial statistics commands.
![]() |
MD*TECH Method and Data Technologies |
http://www.mdtech.de mdtech@mdtech.de |