Description Usage Arguments Value Author(s)
View source: R/SpecimenIDing_functions.R
This function is for a balanced KNN identification design applied to multiple unknown specimens. Groups are resampled iteratively to equal sample size; note this is done by downsampleing the groups to a sample size set by the user or if left to default to the sample size of the smallest groups. Bootstrap resampling is not provided as an option because this can be problematic for nearest neighbour approaches because of duplication of neighbours.
1 2 3 4 5 6 7 8 9 10 | KnnDistIDingBal(
DistMat,
GroupMembership,
UnknownIdentifier = "Unknown",
SpecimenIDs,
K,
EqualIter = 100,
TieBreaker,
SampleSize = NA
)
|
DistMat |
is a square matrix of pairwise distances among all reference specimens. |
GroupMembership |
a character or factor vector in the same order as the distance data to denote group membership. |
UnknownIdentifier |
the name used in the |
SpecimenIDs |
should be a list of the specimens unique identifiers for all specimens in the |
K |
is the number of nearest neighbours that the method will use for assigning group classification. |
EqualIter |
sets the number of iterations resampling to equal sample size will be carried out. |
TieBreaker |
is the method used to break ties if there is no majority resulting from K. Three methods are available('Random', 'Remove' and 'Report'): Random randomly returns one of tied classifications; Remove returns 'UnIDed' for the classification; Report returns a the multiple classifications as a single character string with tied classifications separated by '_'. NOTE: for correct cross-validation proceedures the results of both Report will be considered an incorrect identification even if one of the multiple reported classifications is correct. |
SampleSize |
is the sample number that groups will be subsampled to if |
Returns a matrix of the leave-one-out classifications for all the specimens along with their known classificaiton.
Ardern Hulme-Beaman
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.