# Unexpected behavior in inhomogeneous Cross K Function (Kcross.inhom) [closed]

I am currently analyzing a point pattern in R using the "spatstat" package. I am comparing two different areas, therefore I made two plots for each area (first two plot-left-area1; second two plots-right-area2) I applied ginhom(r) for all the points from each area and the points have a random pattern, here is an example of the script:

#pcfinhom for area1 (first two plots)
bwp<- bw.pcf(poi_all, divisor="r", kernel="epanechnikov") #bw=1.426384 m
r1i<- envelope(poi_all, pcfinhom, nsim = 1000, savefuns=TRUE, conf.level= 0.95, correction= "isotropic", kernel = "epanechnikov", bw = bwp, renormalise=TRUE)
plot(r1i, xlab ="Distance r [m]", main= "pcf - Protected area", xlim = c(0,40), ylim=c(0,5), legend= F)
rlii<-LF.gof(r1i) # p value = 0.2117882 points are random


However, when I apply Kcross.inhom(r) to the assess the spatial relationship between different tree sizes from the area1 (first two plots), I receive strange graphs that I am not sure if are correct:

bw1 <- bw.diggle(poi_rr1, correction="isotropic", hmax=NULL, nr=400) #bw=9 m
pikros <- envelope(poi_rr1, Kcross.inhom, nsim=1000, i="A", j="S", correction = "isotropic",savefuns=TRUE, bw = bw1, renormalise=TRUE)
plot(pikros,main="Cross-K inhom - Protected area", xlab = "Distance r [m]",xlim = c(0,40), ylim=c(0, 500), legend = F)
pk <- LF.gof(pikros) # p value= 0.00990099 saplings are clustered around adults


I applied the same script for adults-intermediate (A, I) and intermediate-saplings (I,S) and the results can be seen in the following graphs:

# Graph Kcross.inhom for intermediate - sapling trees (without bw and a different kcross.inhom scale)

For all the graphs, the p values are significant. I tried bw.diggle = 9.6m, bw.stoyan = 1 m and bw.pcf= 3.3 m but I am not sure which is proper to use, since I received different values depending on the bw that I use.

# Question 2: Is there a mistake in the script of the Kcross.inhom function or can I consider the graphs correct?

Thank you in advance for your help!

## closed as off-topic by Xi'an, Michael Chernick, mkt, mdewey, Peter Flom♦Jan 23 at 12:10

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – Xi'an, Michael Chernick, mkt, Peter Flom
If this question can be reworded to fit the rules in the help center, please edit the question.