Learn R Programming

assignR (version 1.2.0)

pdRaster: 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

RasterStack or RasterBrick with two layers, e.g., as created by calRaster. The first layer is the tissue-specific isoscape and the second the isoscape prediction uncertainty (1 standard deviation).

unknown

data.frame. First column should be unique sample IDs, and second column should be tissue isotope values for the individuals for which the assignments will be made.

prior

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

mask

SpatialPolygonsDataFrame. This 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.

Value

RasterStack or RasterLayer including a probability density surface for each individual in unknown. If saveFiles == TRUE writes individual rasters in GeoTIFF format and a single PDF file with images for each probability density raster to the working directory.

See Also

calRaster

Examples

Run this code
# NOT RUN {
# load North America boundary and global isoscape
data("naMap")
data("d2h_world")

# load hydrogen isotope data for human hair in North America
d = subOrigData(taxon = "Homo sapiens", 
  reference = "Ehleringer et al. 2008", mask = naMap)

# rescale from environmental isoscape to tissue isoscape
r = calRaster(known = d, isoscape = d2h_world, mask = naMap)

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

# posterior probability surface
asn = pdRaster(r, unknown = un, mask = naMap)
# }

Run the code above in your browser using DataLab