8
I have to analyze the spatial pattern of some cactus distributions in the field, and since they are heterogeneous, I cannot use Ripley’s K-function (and corresponding L-function) for stationary patterns. With the spatstat package, I calculated and plotted the "in-homogeneous" L function. But I would like to get the calculated values, so I can specify in which values exactly the curve shows pattern change.
Here is an example:
m22.X<-c(16809,4705,19772,5294,107,623,17361,19397,2827,3875,17326,12150,9827,11853,8888,10973,2015,3528,3751,3406,3425,276,1693,44,9794,664,701,762,3601,5577,15122,4757,6293,5077,4801,972,5133,6077,4754, 18036,12805,18731,12312,3414,3405,3369,17476,16794,19343,17703, 11834,11913,11931)
m22.Y<-c(15691,5662,15168,2389,16703,15305,15372,19822,8108,17493,10783, 9227,281,8153,11943,14446,18802,15551,17505,15598,18134,15904, 18151,16408,179,17807,17801,17007,19342,16003,124,3041,5605,3107, 3072,3309,5905,5904,7500,12377,8312,14056,8315,15574,15601,18867, 15298,16224,17420,15556,19724,19778,19577)
# cria objeto espacial para spatstat:
loc.m22<-ppp(m22.X,m22.Y,c(0,20000), c(0,20000))
# calcula Linhom(...)
linm22<-Linhom(loc.m22, correction="best")
plot(linm22,lwd=2)
#calcula intervalo de confiança de L:
bootlm22<-lohboot(loc.m22,fun="Linhom",nsim=1000,correction="best",confidence=0.95,type=7)
plot(bootlm22,lwd=2)
So in the graph, you can see that the shaded area of the confidence interval intersects the dotted line (which marks L values for a Poisson distribution) about when r=1,300, but that the full line only intersects roughly at r=2,500. But what are the exact values? I tried the following:
theo.values<-bootlm22$theo
iso.values<-bootlm22$iso
r.values<-bootlm22$r
matriz<-cbind(r.values,theo.values,iso.values)
matriz
#no local da interceptação, o valor de iso(L calculado) == valor de r
intercept<-matriz[(matriz[,1]==matriz[,3]),]
but it didn’t work. Does anyone have any idea? I’ve already searched the attributes of the linhom function, but I haven’t found a field that matches what I want.
Thank you, Leila
Wow, @Molx! Thanks! You’ve made it so easy! It works perfectly.
– Leila
@Leila, if Molx’s answer met you, you can accept it by clicking the "ok" button on the left!
– Carlos Cinelli
Thank you, @Carloscinelli
– Leila