A function to allocate coordinates to an observation whose spatial location is known to the regional level
allocate(poly, popden, survdat, pid, sid, n = 2, wid = 2000)
matrices x and y, both of size (number of observations in survdat x n) giving n potential candidate locations of points in the columns of x and y.
a SpatialPolygonsDataFrame, on which the survival data exist in aggregate form
a sub-polygon raster image of population density
data.frame containing the survival data
name of the variable in the survival data that gives the region identifier in poly
the name of the variable in poly to match the region identifier in survdat to
the number of different allocations to make. e.g. if n is 2 (the default) two candidate sets of locations are available.
The default is 2000, interpreted in metres ie 2Km. size of buffer to add to window for raster cropping purposes: this ensures that for each polygon, the cropped raster covers it completely.