View source: R/SpatialProvDistInput_function.R
IDbyDistanceDistInputCCV | R Documentation |
This function takes pairwise distances among all reference specimens with known spatial origins and uses those distances to calculate the correllation value that would be required to correctly provenancing them in a test. This is achieved by a leave-one-out procedure. If a cross-validation procedure that removes more than one specimen from the reference dataset is desired then it is recommended that the validate function of the IDbyDistanceDistInput method be used with the validate argument in a loop.
IDbyDistanceDistInputCCV( LatLongs, DistDataMat, Verbose = TRUE, PrintProg = TRUE, ProvConfidence = 0.95, Method = c("Pearson", "Spearman") )
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. |
DistDataMat |
is a square matrix of pairwise distances among all reference specimens |
Verbose |
logical whether or not a matrix of spatial correlation values is returned or not. Default is set to TRUE. |
PrintProg |
logical whether or not to print a progress bar. Default set to FALSE. |
ProvConfidence |
is a value between 0 and 1 indicating the confidence level that is desired for spatial provenancing. |
Method |
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. |
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.
If Verbose is set to FALSE then a list of a single object containing the correlation value at the required confidence interval is returned. If Verbose is set to TRUE then a list is returned with two objects: the first is the correlation value at the required confidence interval; the second a dataframe of coordinates and the spatial-trait correlation values at the true locations of each specimen.
Original S code by Richard A. Becker, Allan R. Wilks. R version by Ray Brownrigg. Enhancements by Thomas P Minka and Alex Deckmyn. (2017). maps: Draw Geographical Maps. R package version 3.2.0. https://CRAN.R-project.org/package=maps
Grosjean, Ph. (2016). svMisc: SciViews-R. UMONS, Mons, Belgium. http://www.sciviews.org/SciViews-R.
Ardern Hulme-Beaman
RatDistMat <- ProcDistanceTable(Rpraetor$LMs)
Range.Exp <- .5
Long.Range <- c(floor(min(Rpraetor$Lat.Long$Long)) -Range.Exp,ceiling(max(Rpraetor$Lat.Long$Long)+Range.Exp))
Lat.Range <- c(floor(min(Rpraetor$Lat.Long$Lat)) -Range.Exp,ceiling(max(Rpraetor$Lat.Long$Lat)+Range.Exp))
rThres <- IDbyDistanceDistInputCCV(LatLongs = Rpraetor$Lat.Long, DistDataMat = RatDistMat, Verbose = TRUE, ProvConfidence = .95, PrintProg = FALSE, Method = 'Spearman')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.