data(paracou16)
# Keep only 20% of points to run this example
X <- rthin(paracou16, 0.2)
plot(X)
# Density of all trees
lambda <- density.ppp(X, bw.diggle(X))
plot(lambda)
V.americana <- X[X$marks$PointType=="V. Americana"]
plot(V.americana, add=TRUE)
# Calculate Kinhom according to the density of all trees
r <- 0:30
ActualValues.X <- Kinhom.r(X, r, "V. Americana", lambda)
# Calculate confidence envelope (should be 1000 simulations, reduced to 4 to save time)
NumberOfSimulations <- 4
Alpha <- .10
LocalEnvelope.X <- KinhomEnvelope(NumberOfSimulations, Alpha, X, r, ,
SimulationType="RandomPosition", lambda=lambda)
# Plot
PlotResults(r, DivideByPiR2(ActualValues.X, r), lapply(LocalEnvelope.X, DivideByPiR2, r),
ylab="Kinhom / (pi R^2)", ReferenceValue=1)
Run the code above in your browser using DataLab