filterOnDistance {spbal} | R Documentation |
The input parameter minRadius >= 0 is the minimum distance between any two points in the sample. My idea is to apply this condition to the points in the over-sample, result$overSample. Let's call these points x1, x2, ..., xB. Create a new set S = (x1). Starting from x1, we check if dist(S,x2) > minRadius. If it is, add x2 to S. For x3, we check if dist(S,x3) > minRadius, where dist is the smallest distance from a point in S to x3 (single linkage distance). If dist(S,x3) > minRadius, add x3 to S. Continue until you reach xB.
The distances are calculated as great circles over an oblate spheroid and the units are meters.
filterOnDistance(overSample, minRadius)
overSample |
A HIP sample. |
minRadius |
The minimum distance between any two points in the sample. |
Key points:
result$minRadius
is nonempty (it always contains x1). Hence, if the user chooses a crazy minRadius, they get one point.
result$minRadius
is a subset of result$overSample.
The number of points in result$minRadius is random. That's fine!
If they want n points and result$minRadius has less than n, too bad! They can reduce minRadius and/or increase the iterations parameter.
If they want a sample with the minimum radius property, they use:
smp <- result$minRadius
sample <- smp[1:n,]
S The set of points that are more than minRadius from each other.
Phil Davies.