I am using different Goodness of fit tests for objects of class kppm. The goodness of fit tests in the attached code worked fine in version 1.59-0 of spatstat, but in the most recent version (1.61-0 and 1.61-0.019), there is an error related to rinterval
.
The code with seeds to replicate the error is:
library(spatstat)
#### Seed to recreate the same results ####
set.seed(1234)
#### Model from Thomas process ####
Data.Example <- rThomas(5, 0.05, 10) # kappa, scale, mu
#### Fitting a Thomas model ####
DE.fit.Thomaskppm <- kppm(Data.Example, ~ 1, "Thomas")
#*********************************************************
#### Goodness-of-fit test ####
#*********************************************************
####Using Dao-Genton test ####
#Thomas model
set.seed(100000)
dg.test(DE.fit.Thomaskppm, rinterval = c(0, 0.25))
#### Diggle-Cressie-Loosmore-Ford test ####
#Thomas model
set.seed(100000)
dclf.test(DE.fit.Thomaskppm, rinterval = c(0, 0.2))
#### Maximum Absolute Deviation Tests ####
#Thomas model
set.seed(100000)
mad.test(DE.fit.Thomaskppm, rinterval = c(0, 0.2))
The error is:
Error in envelopeTest(Yi, ..., nsim = nsimsub, alternative = alternative, :
Some function values were infinite, NA or NaN at distances r up to 0.25 units. Please specify a shorter ‘rinterval’
This error appeared in version 1.59-0, but it was fixed by setting the rinterval
from 0 to 0.25. In 1.61-0 version, I set the rinterval
even shorter, but this error continues to appear.
dclf.test
and mad.test
work fine if I use 10 as the seed.
Thanks in advance.