I am using the
Jfox function in
spatstat to explore the distance of points in a point pattern to the nearest polygon between a set of points and a set of polygons in an area.
my code is something like:
points is the point pattern object, while
win is the
owin that represent the polygons from which I want to calculate the distance from my points.
When I run the code I, so far, always get a warning saying
In resolve.foxall.window(X, Y, W) : Trimming the window of X to be a subset of the Frame of Y
I tried to understand what it means by looking into the code of the
resolve.foxall.window function (available here https://rdrr.io/cran/spatstat/src/R/GJfox.R) and plotting the frame of Y, along with the points and the points' window.
- the open circle is my point (I know it's only one and probably not worth the analysis but this was actually the case that got my attention because, when trimming the window, the point was excluded from the computation and thus the absence of points in the trimmed window generated an error)
- the solid red polygons are my polygons stored in the
- the black outline is the Window of the point pattern (the irregular shape is because it was an photographic collage)
- the green square is the Frame of
- the red square (partially overlapped by the blue shape) is the Frame of
- the blue shape is the trimmed window resulting from the instersection of the Frame(Y) with Window(X) in the
- From this it seems that only the points falling within the trimmed Window (i.e. the blue shape) will ever be considered for the estimate of the
Jfoxfunction (and similarly the
Gfox). Is this correct?
- If this 1 is correct, does this depend on the fact that for points outside the trimmed windows it is not possible to measure a distance with some feature (another polygon) that may potentially be present outside the Window of observation of the points (i.e. the black outline, my area of study)?
- Always if 1 is correct, does it means that is then impossible to calculate a
Gfoxdistance in the case there is only 1 polygon in the object
- Could it be correct to make the Frame(Y) as big as the Window(X) to include all the points in a ppp?