KnnDistIDingGroup: k-Nearest Neighbour multiple specimen identification

Description Usage Arguments Value Author(s)

View source: R/SpecimenIDing_functions.R

Description

This function is for an unbalanced kNN identification design applied to multiple unknown specimens.

Usage

1
2
3
4
5
6
7
KnnDistIDingGroup(
  DistMat,
  GroupMembership,
  UnknownIdentifier = "Unknown",
  K,
  TieBreaker
)

Arguments

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 GroupMembership argument to denote specimens to be identified. Only one name can be supplied as Unknown; default is set to 'Unknown'.

K

is the number of nearest neighbours that the method will use for assigning group classification.

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.

Value

Returns a matrix of the leave-one-out classifications for all the specimens along with their known classificaiton.

Author(s)

Ardern Hulme-Beaman


ArdernHB/KnnDist documentation built on Feb. 5, 2021, 5:09 a.m.