TraitBoundaryStats: Calculates trait boundary overlaps and statistics from...

View source: R/Boundary_functions.R

TraitBoundaryStatsR Documentation

Calculates trait boundary overlaps and statistics from Boundaryfinding R object

Description

This function takes the results of the BoundaryFinder function that have been stored in an array and returns the statistics of the area coverage of boundaries found for each specimen based on the provided r threshold. This function is particularly useful when using the parallel processing function BoundaryFinderPar, which does not return the Provenancing area values or percentages that are returned by the BoundaryFInder function when the verbose aregument is set to TRUE.

Usage

TraitBoundaryStats(RawCorArray, LatLongs, RefIDs, PlotValCor)

Arguments

RawCorArray

an array of correlation values for each reference specimen where columns and rows correspond with longitude and latitude and the third dimension represents each individual reference specimen. Default is set to NA.

LatLongs

a matrix of n rows by 2 columns where n is the number of reference specimens in your dataset and the columns are Latitude and Longitude values in that order. These latitude-longitude coordinates should be of the locations of the reference specimens.

RefIDs

is a vector of the unique identifiers for each of the reference specimens in the reference dataset. These values will be used for naming the files in the datadump folder and also for matching up with the returned summary results. Default is set to NULL and if this is not populated then reference data is worked through consecutively, naming the datadump files in consecutive order.

PlotValCor

numeric correlation value that is used to determine the most likely origin of the specimen. This value can be calculated by using the correct cross-validation method and identifying the correlation value that will correctly identify a desired percentage of specimens (e.g. 95%).

Value

This function returns a list of two objects: 1. the area of the convex hull of the distribution of samples and 2. a dataframe of two columns with the area returned of reach specimen in the identification process and the corresponding percentage that area represents of the sample distribution.

Author(s)

Ardern Hulme-Beaman

Examples

FteydeaThres <- IDbyDistanceDistInputCCV(LatLongs = Fteydea$Info[,2:3],
               DistDataMat = Fteydea$SongDisMat,
               Verbose = TRUE,
               ProvConfidence = .95,
               PrintProg = FALSE,
               Method = 'Spearman')
TraitBoundaryStats(PlotValCor = FteydeaThres$`Provenancing.Correlation.95%.Confidence`,
               RawCorArray = Fteydea$Total.Boundary$RawCorData,
               LatLongs = Fteydea$Info[,2:3],
               RefIDs = Fteydea$Info[,1])


ArdernHB/GeoOrigins documentation built on Nov. 19, 2022, 10:21 a.m.