gendis: Calculates a generalized discriminant function

View source: R/gendis.r

gendisR Documentation

Calculates a generalized discriminant function

Description

gendis calculates a generalized discriminant function to distinguish two classes, typically sexes (male and female birds) based on measurements of a number of indicators for individuals from each of the two sexes from a series of different populations in which individuals may have a different mean size but a common-within covariance matrix.

Usage

gendis(
  population = "population",
  sex = "sex",
  measurements = "other_variables",
  verbose = FALSE,
  data
)

Arguments

population

a name of the variable for the populations in the data (default "population")

sex

a name of the variable indicating the two classes to distinguish in the data (default "sex") (0 vs 1 or "female" vs "male")

measurements

character ("other_variables", default) or character vector with names of measurement variables. gendis maintains the order of the names.

verbose

logical (default = FALSE)

data

data frame with variables

Value

An object of class gendis which is a named list, among which,

population

name of variable indicating populations

sex

name of variable indicating the two sexes or classes

classnames

names for the classes of sex (level or value)

measurements

names of the variables in the GDF

GDF

the Generalized Discriminant Function, matrix with two columns differing in scaling of the GDF

mean.male

overall mean of males (the second level of factor(sex))

mean.female

overall mean of females (the first level of factor(sex))

within.sd

overall within standard deviation

cov_overall

overall within-group covariance matrix

means.male

mean of males per population

means.female

mean of females per population

within.sds

within standard deviation per population

ind_mv

number of males and females per population

cov_list

within-group covariance matrix per population

Nind

number of individuals

Np

number of populations

References

van Franeker, J A. ter Braak, C J F. 1993. A generalized discriminant for sexing fulmarine petrels from external measurements. The Auk 110: pp 492-502, https://doi.org/10.2307/4088413 https://edepot.wur.nl/249350

See Also

predict.gendis, summary.gendis, print.gendis.

Examples

data("fulmarin")
names(fulmarin)
result <- gendis(population = "population", sex = "sex",
                 measurements = "other_variables", verbose = FALSE ,  data=fulmarin )
result$GDF
summary(result)
print(result)

# populations may have names:
fulmarin$pop <- factor(c("a1","a2","a3","a4","a5","a6")[fulmarin$population])
levels(fulmarin$pop)
names(fulmarin)
result2 <- gendis(population = "pop", sex = "sex",
                  measurements = c("HB","BD2","TL","CL"), verbose = FALSE ,  data=fulmarin )
# all equal should not give numeric differences.
#all.equal(result, result2)

result2$GDF - result$GDF




CajoterBraak/Gendis2unmix documentation built on Aug. 5, 2023, 1:36 p.m.