'cutoff error using custom kernel in Smooth.ppp
I need to use a custom kernel with the Smooth function, but attempting this throws an error even though I specify cutoff:
Error: The argument ‘cutoff’ is required when a non-Gaussian kernel is specified and scalekernel=FALSE
n=4; PPP=ppp(rep(1:n,n),rep(1:n,each=n), c(1,n),c(1,n), marks=1:n^2);
Smooth.ppp(PPP,cutoff=50,kernel=gaussian,at="points")
Here is a toy example that makes the same error. I'm not 100% sure whether this is an error or something that's unintuitive to me. Thank you!!
Solution 1:[1]
This is a bug. Thank you for bringing it to our attention.
It has been fixed in the development version of spatstat.core (2.4-2.003) which is available at the GitHub repository
The bug only affects the case where kernel is a function, at="points", and scalekernel=FALSE. In the meantime you can get the desired result by either
- Adding
scalekernel=TRUEandsigma=1, or - Deleting
at="points"so that the result is a pixel imageZsay, and extracting the desired values byZ[PPP].
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Adrian Baddeley |
