KVote: Function for calculating the majority vote

Description Usage Arguments Value Author(s)

View source: R/ComplexInternal_functions.R

Description

This function carried out k-NN analyses on the provided data.

Usage

1
KVote(X, K, Weighting = FALSE, TieBreaker = c("Random", "Remove", "Report"))

Arguments

X

a vector or matrix of the nearest neighbours. If Weighting=TRUE then a matrix is expected with the first column being the membership names of nearest neighbours and the second column should be the distances to each neighbour; if Weighting=FALSE then the just a vector of the membership names of nearest neighbours is required.

K

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

Weighting

is a logical TRUE or FALSE determining whether classification will be based on a weighted K. In this method a simple weighting system is used where weights are 1/distance, where distances is the distance of the considered neighbour from the unknown.

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 the classification of the unknown individual to be identified.

Author(s)

Ardern Hulme-Beaman


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