IDbyDistanceDistInputPar: Spatially provenance a specimen from distance data adapted...

View source: R/ParallelProcessing_functions.R

IDbyDistanceDistInputParR Documentation

Spatially provenance a specimen from distance data adapted for use in parallel processing

Description

This function is primarily for compatibility with the parallel processing foreach package. It takes the distances from an unknown specimen to all reference specimens and uses these distances to calculate a likely spatial provenance. Note that this procedure can only be applied to one unknown specimen at a time. This distance input function allows the user to input any dissimilarity or distance desired and as appropriate for the data. The function has two applications either: calculating a specimens' provenance, or alternatively it can be used to calculate the minimum correlation coefficient needed to correctly identify a known specimen at its true collection location. The second application of this function can work as a correct cross-validation process if looped, but see IDbyDistanceDistInputCCV function which does this automatically in a leave-one-out process. However, if a corss-validation process that removed more than one specimen from the reference dataset at a time is required then it is advised that this be applied using this function.

Usage

IDbyDistanceDistInputPar(
  LatLongsPar,
  DistDataVecPar,
  LongRangePar,
  LatRangePar,
  RangeSamp = 10,
  MethodPar = c("Spearman", "Pearson")
)

Arguments

LatLongsPar

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.

DistDataVecPar

is a vector of distances from each reference specimen to the specimen of interest (either a specimen with unknown provenance or another reference specimen that the user is interested in validating the provenance of)

LongRangePar

is a vector of 2 elements defining the maximum and minimum Longitude values that the provenancing method should explore. This will also define the mapping range in the final plotted output.

LatRangePar

is a vector of 2 elements defining the maximum and minimum Latitude values that the provenancing method should explore. This will also define the mapping range in the final plotted output.

RangeSamp

is an integer vector of 1 or 2 elements that defines the resolution of spatial sampling. If one element is provided then both the latitude and longitude ranges are equally and evenly sampled using this value. If 2 elements are provided they should be in the order of latitude longitude and each range will be evenly sampled with its respective value.

MethodPar

determines what kind of correlation coefficient should be used, either "Spearman" or "Pearson". Spearman's ranked correlation coefficient does not assume a linear relationship between geographic and trait distances, whereas Pearson's coefficient does.

Details

This method also makes use of the cor.test function from the stats package. When the PrintProg is set to TRUE, the progress function of the svMisc package is used. The map plotting of this function makes use of the functions of the maps package.

Value

If Verbose is TRUE then a dataframe of all values for every sampled grid reference is returned. If Verbose is FALSE then only those grid references with the highest correlation values are returned.

Author(s)

Ardern Hulme-Beaman


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