select_traits {AnthropMMD}  R Documentation 
Select a subset of traits meeting certain criteria
Description
This function provides several strategies to discard some useless traits (nonpolymorphic, nondiscriminatory, etc.) upstream the MMD analysis.
Usage
select_traits(tab, k = 10, strategy = c("none", "excludeNPT",
"excludeQNPT", "excludeNOMD", "keepFisher"), OMDvalue = NULL, groups,
angular = c("Anscombe", "Freeman"))
Arguments
tab 
A table of sample sizes and frequencies, typically returned
by the function 
k 
Numeric value: the required minimal number of individuals per group. Any trait that could be taken on fewer individuals in at least one group will be removed from the dataset. This allows to select only the traits with a sufficient amount of information in each group. 
strategy 
Strategy for trait selection, i.e. for the removal of
nonpolymorphic traits. The four options are fully described in
Santos (2018) and in the help page of 
OMDvalue 
To be specified if and only if 
groups 
A factor or character vector, indicating the group to be
considered in the analysis. Since some groups can have a very low
sample size, this will allow to discard those groups in order to
facilitate the trait selection via the argument

angular 
Formula for angular transformation, see Harris and Sjøvold (2004). Useful only for the calculation of overall measure of divergence. 
Value
A list with two components:
filtered 
The dataset filtered according to the userdefined criteria. 
OMD 
The “overall measure of divergence” for each trait. 
Author(s)
Frédéric Santos, frederic.santos@ubordeaux.fr
References
Harris, E. F. and Sjøvold, T. (2004) Calculation of Smith's mean measure of divergence for intergroup comparisons using nonmetric data. Dental Anthropology, 17(3), 83–93.
Santos, F. (2018) AnthropMMD: an R package with a graphical user interface for the mean measure of divergence. American Journal of Physical Anthropology, 165(1), 200–205. doi: 10.1002/ajpa.23336
See Also
Examples
## Load and visualize a binary dataset:
data(toyMMD)
head(toyMMD)
## Convert this dataframe into a table of sample sizes and
## relative frequencies:
tab < binary_to_table(toyMMD, relative = TRUE)
tab
## Filter this dataset to keep only those traits that have at
## least k=10 individuals in each group:
select_traits(tab, k = 10)
## Only Trait1 is excluded.
## Filter this dataset to keep only those traits that have at
## least k=11 individuals in each group, and show significant
## differences at Fisher's exact test:
select_traits(tab, k = 11, strategy = "keepFisher")
## Traits 1, 5 and 8 are excluded.