p 19 p 33 p 66, 72 p 98 sp = swedishpines plot(density(sp, sigma = 10)) sp.den = density(sp, sigma = 10) plot(sp.den) plot(sp, add =T, pch = "o", cex = .5) K.sp = Kest(sp) # suggests repelled up to distance about 10 units # section 21 sp.Poisson = ppm(sp) plot( envelope( sp.Poisson, nsim = 39) ) sp.Str.fit = ppm( sp, ~1 , Strauss(r=10)) plot( envelope( sp.Str.fit, nsim = 39) ) # envelope( sp.Str.fit, fun = G, nsim = 39) : use a different PP summary function sp.sim = rmh( sp.Str.fit) # Section 24, p 160: create ppp data set lf = data(longleaf) plot(lf) # use data with large marks; write to file ind = lf$marks>=15 xym = cbind( lf$x[ind], lf$y[ind], lf$marks[ind]) write.table(xym, "biglongleaf.dat", col.names= c("x", "y", "dbh")) # now treat bigleaf.dat as a data set (not in ppp format) to read into R bl.dat = read.table("biglongleaf.dat", header = T) bl = data.frame( x = bl.dat[,"x"], y = bl.dat[,"y"], m = bl.dat[,"dbh"]) bigleaf = as.ppp( bl, square(200) ) # bigleaf = as.ppp( bl, owin( c(0,200), c(0,200) ) ) bigleaf2 = scanpp( "biglongleaf.dat", window = square(200) ) summary(lf) X = cut( longleaf, breaks = c(0, 30, 80), labels = c("juvenile", "adult") ) X hist(lf$marks) hist(bigleaf$marks) lf.m.hat = smooth.ppp( longleaf) plot(lf.m.hat) plot( alltypes( X, "K") ) # mark correlation function f.prod = function( x,y){ x*y } M.lf = markcorr( longleaf, f.prod) plot( M.lf) M.lf = markcorr( longleaf, f.prod, kernel = "gaussian", width = 5) plot( M.lf) M.lf = markcorr( longleaf, f.prod, kernel = "epanechnikov") plot( M.lf) K.env = alltypes( lf, Kcross, nsim = 39, enveope = T) plot(K.env)