pdRaster {assignR}R Documentation

Probability of origin surfaces

Description

Calculate posterior probabilities of origin for a sample based on its isotope ratio.

Usage

pdRaster(r, unknown, prior = NULL, mask = NULL, genplot = TRUE, outDir = NULL)

Arguments

r

SpatRaster with two layers, rescale object (see calRaster), or isoStack object. For user-generated raster objects, the first layer must be the substrate-specific isoscape (mean prediction) and the second the isoscape prediction uncertainty (1 standard deviation).

unknown

data.frame, refTrans object, or list of two or more refTrans objects. For user-created data.frame, first column should contain unique sample IDs, and subsequent columns should contain sample isotope values for one or more isotopes to be used in assignment.

prior

SpatRaster. Optional raster layer with prior probabilities, which has the same projection, resolution and extent as r.

mask

SpatVector. This polygon mask will constrain the assignment area. If this is not provided, a default of mask of the extent of r is used.

genplot

logical. Plot results in R.

outDir

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

Details

If more than one isotope marker is to be used for multivariate assignment, r must be an isoStack object and the number of isoscapes in that object must be equal to the number of isotope-value columns or refTrans objects included in unknown. Isoscapes and unknown sample values will be matched based on order, so it is critical that the values appear in the same order in these two input objects.

Value

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

See Also

calRaster refTrans isoStack

Examples

# 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)

# sample to assign
id = "smile"
d2H = -80
un = data.frame(id, d2H)

# posterior probability surface
pp = pdRaster(r, un, mask = naMap)

[Package assignR version 2.4.0 Index]