qtlRaster {assignR}R Documentation

Sample assignment using thresholds


Selects the grid cells of probability density rasters with the highest probability and returns rasters with these cell values set to 1. Cells are selected based on the user-specified quantile threshold so that the most-probable cells representing a given fraction of the assignment area or posterior probability are returned.


qtlRaster(pdR, threshold, thresholdType = "area", genplot = TRUE, outDir = NULL)



SpatRaster. Probability density maps for individual samples, e.g., as output by pdRaster.


numeric from 0 to 1. Quantile to be selected.


character. Either “area” (default) or “prob”. If “area”, the most probable cells constituting threshold percent of the assignment area are selected. If “prob”, the most probable cells constituting threshold percent of the posterior probability are selected.


logical.Plot results in R.


character string. Directory path to which output will be saved. If NULL no files are written.


SpatRaster including a binary assignment surface for each individual in pdR. If outDir is not NULL, writes individual rasters in GeoTIFF format and a single PDF file with images for each raster to the designated directory.



# load hydrogen isotope data for human hair in North America
d = subOrigData(group = "Modern human", mask = naMap, genplot = FALSE)

# rescale from environmental isoscape to tissue isoscape
r = calRaster(d, d2h_lrNA, naMap, genplot = FALSE)

# four unknown-origin examples
id = c("A", "B", "C", "D")
d2H = c(-110, -90, -105, -102)
un = data.frame(id, d2H)

# posterior probabilities
pp = pdRaster(r, un, mask = naMap, genplot = FALSE)

# assign to most probable 10 percent of area
## Not run: qtlRaster(pp, threshold = 0.1)

# assign to most probable 10 percent of proabability distribution
qtlRaster(pp, threshold = 0.1, thresholdType = "prob")

[Package assignR version 2.4.1 Index]