repDFA: repeated DFAs with balanced subsets

View source: R/repDFA.R

repDFAR Documentation

repeated DFAs with balanced subsets

Description

can be used to determine variables that discriminate in the context of permuted DFA

Usage

repDFA(xdata, testfactor, balancefactor, varnames, npercomb = NULL, nrand = 20)

Arguments

xdata

a data.frame with the data

testfactor

character, the name of the column for the test factor (grouping factor)

balancefactor

character of length 1 or 2, the factor(s) used for balancing

varnames

character vector, column names of the numeric variables to be used for DFA

npercomb

the number of cases per level of balancefactor (if one balance factor) or the number of cases per combination of balancefactor (if two balance factors)

nrand

numeric, the number of DFAs to be calculated

Details

information for second function will only be returned if there were at least 2 functions calculated

Value

a data.frame with information on the first (and if appropriate also second) discriminant function

  • name of the variable with the highest absolute loading

  • loading of the variable on the given function (can be either negative or positive)

  • proportion of variance explained by the function

Author(s)

Christof Neumann

References

Berthet, M., Neumann, C., Mesbahi, G., Cäsar, C., & Zuberbühler, K. (2018). Contextual encoding in titi monkey alarm call sequences. Behavioral Ecology and Sociobiology, 72(1), 8.

Mundry, R., & Sommer, C. (2007). Discriminant function analysis with nonindependent data: consequences and an alternative. Animal Behaviour, 74(4), 965-976.

See Also

balancedataset

Examples

data(iris)
res <- repDFA(xdata = iris, testfactor = "Species", balancefactor = "Species",
              varnames = c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width"),
              npercomb = 5, nrand = 50)
table(res$df1_best)
table(res$df2_best)

gobbios/cfp documentation built on April 11, 2022, 2:22 a.m.