library(spatstat) # A process with real-valued marks data(longleaf) plot(longleaf) # Kernel smoothed mark intensity plot(smooth.ppp(longleaf)) # Histogram of marks plot(hist(marks(longleaf))) # Mark correlation function plot(markcorr(longleaf)) # Envelope of the mark correlation function -- not sure exactly how # the marks are being resampled... from the docs it seems as if # they are sampled with replacement E = envelope(longleaf,markcorr) # A point process with categorical marks data(lansing) plot(lansing) # cross G function for blackoak and hickory trees and envelope plot(Gcross(lansing, 'blackoak', 'hickory')) E = envelope(lansing, Gcross, i='blackoak', j='hickory', simulate=expression(rshift(lansing, radius=0.25))) plot(E) # Similar, but not exactly the same plot(Gcross(lansing, 'blackoak', 'hickory')) E = envelope(lansing, Gcross, i='blackoak', j='hickory') plot(E) # Mark correlation for the blackoak and hickory trees f12 = function(m1, m2) { return (m1 == 'blackoak') * (m2 == 'hickory') } plot(markcorr(lansing, f12)) # Mark correlation for any matches fany = function(m1, m2) { return (m1 == m2) } plot(markcorr(lansing, fany)) # Random labelling, function taken from p.177 of spatstat doc Kdif = function(X, ..., i) { Kidot = Kdot(X, ..., i = i) K = Kest(X, ...) dif = eval.fv(Kidot - K) return(dif) } E = envelope(lansing, Kdif, i='blackoak', simulate=expression(rlabel(lansing))) plot(E)