Package 'sidclosepairs'

Title: Inhibitory with close pairs sampling
Description: Implements various methods for sampling inhibitory points with a number of close pairs.
Authors: Barry Rowlingson [aut, cre] , Mélodie Sammarro [aut]
Maintainer: Barry Rowlingson <[email protected]>
License: GPL (>= 3)
Version: 0.1.1.0
Built: 2024-08-31 05:06:32 UTC
Source: https://gitlab.com/b-rowlingson/sidclosepairs

Help Index


Add some close pairs to a set of points

Description

Add close pair points to a set of points.

Usage

add_close_pairs(ptsxy, n_close_pairs, poly, zeta)

Arguments

ptsxy

spatial point data frame or matrix of coordinates

n_close_pairs

number of close pair points to generate

poly

sf-class polygon object

zeta

Close point radius

Details

This function adds close pair points to any set of points. It is used internally by the icpSample function but can be used to add close pairs to any set of points.

Each close point is generated randomly uniformly within the disc of radius zeta from a randomly selected initial point, without replacement, so that initial points cannot have more than one close point generated.

Value

spatial point data frame or coordinate matrix with all points

Author(s)

Barry Rowlingson, Melodie Sammarro


General purpose inhibitory close pairs point generation

Description

Generate a set of points based on a set of initial inhibitory points with some number of close pair points added to them.

Usage

icpSample(n, k, delta, zeta, poly, proposal = "", rdensity, censusxy)

Arguments

n

Total number of output points

k

Number of close pairs

delta

Inhibitory radius

zeta

Close point radius

poly

sf-class polygon object

proposal

Method for generating primary points

rdensity

Raster for "density" method

censusxy

x-y matrix for "census" method

Details

This function generates a set of inhibitory close-pairs points by first generating initial points from one of the proposal methods,

There are three "proposal" methods for generating the initial inhibitory points - the default uniform randomly in a polygon, "density", which uses a by density specified by a raster, and "census", which samples from a (typically dense) set of points such as a full census of an area. The initial points are guaranteed to be at least further than the delta parameter apart, and the close pair points will be uniformly in a circle of radius zeta around a random initial point. Note this can result in output points being closer than the delta distance.

The retrned data frame will contain the inhibitory points first, but there is no relation between the close pair points and the inhibitory points returned. A relation can be inferred if the inhibitory points are far enough away but this is not always possible if the inhibitory distance is close to the close point distance.

The initial inhibitory points are generated by an iterative process that is not guaranteed to terminate, and in fact could be guaranteed to not terminate for relatively large inhibitory distances in a small area. For guaranteeing termination, the code may need to be wrapped in a "timeout" function. See the vignettes for an example.

Value

spatial data frame of points

Author(s)

Barry Rowlingson, Melodie Sammarro


sample from multiple polygons.

Description

Generate inhibitory close pairs spread evenly across multiple polygons

Usage

icpSampleM(n, k, delta, zeta, poly)

Arguments

n

Total number of output points

k

Number of close pairs

delta

Inhibitory radius

zeta

Close point radius

poly

sf-class polygon data frame

Details

This function operates similarly to icpSample except it splits the initial points evenly across multiple polygons. If the number of points is not a multiple of the number of polygons then a warning is generated and an uneven partition is used.

Value

a spatial points data frame

Author(s)

Barry Rowlingson, Melodie Sammarro