Spatial patterns: I have a dataset of coordinates and marks (diameter) attributed to the points. I am trying to create a window (owin()) for each plot (I have 2 plots), but I don't know how to set the window for both plots:

My window:

#data: rea_spd "SpatialPointsDataFrame'
w <- owin(xrange = c(min(rea_spd$Longitude_), max(rea_spd$Longitude_)),
          yrange=c(min(rea_spd$Latitude_N), max(rea_spd$Latitude_N)))
#this produces a window for all the data, but I don't know how to adapt it to have a window for each plot.
#After, I calculated Kcross, which works, but I still need to have two windows, otherwise, I will violate the statistical assumptions:
kmultrea <- envelope(reav, Kcross, nsim=999, i="A", j="S",
                     global=F, savefuns=TRUE, conf.level= 0.95)
plot(kmultrea,main="Cross-K - Protected area", xlab = "Distance r [m]", 
     xlim = c(0,30), ylim=c(0, 6000), legend = F)
pk <- LF.gof(kmultrea) #

I tried to follow this example, but I still do not receive the points inside the windows:

m = matrix(0,20,20)
imask = owin(c(0,1),c(0,1),mask = t(m)==1 )
pp1 = ppp(x=c$x,y=c$y,window=imask)

Determining if trees within forest gaps are clustered using R?

enter image description here


1 Answer 1


I think I have found the solution:

#Define ppp and owin window:                                                          poi_rr1 <- as.ppp(poi1)
ww <- as.owin(poly1)
poi_rr1 <- poi_rr1[ww]
marks(poi_rr1) <- factor(poi_rr1$marks$TypeD)  

# ESTIMATE BANDWIDTH                                                                   
bw1 <- bw.diggle(poi_rr1, correction="isotropic", hmax=NULL, nr=400) 

#Calculate Kcross                                                                            
kcross1 <- envelope(poi_rr1, Kcross, nsim=99, i="A", j="S", correction = "isotropic", bw = 9.380343, global=F, savefuns=TRUE, conf.level= 0.95)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.