unmix | R Documentation |
unmix
generates a cutpoint below which individuals are predicted to be female
(level 1 of factor(sex)
) and above which they are predicted to be
male (level 2 of factor(sex)
). The cutpoint is at the point of intersection of two normal densities with unequal
means and variances fitted to argument x
. This function is used internally in the predict.gendis
function.
unmix(x, verbose = FALSE)
x |
a numeric vector of discriminant scores with optional attribute "classnames", e.g. c("female","male") |
verbose |
logical (default = FALSE) |
unmix
is an EM algorithm following example 4.3.2 of Titterington et al. (1985). Alternatively,
library flexmix
could have been used.
A list consisting of
cutpoint
point of equal density of the normal distributions
p1
estimated probability of class 0 ("female"), informally: fraction of individuals in class 0
p2
estimated probability of class 1 ("female"), informally: fraction of individuals in class 0
m1
estimated mean of the normal distribution of class 0
m2
estimated mean of the normal distribution of class 1
v1
estimated variance of the normal distribution of class 0
v2
estimated variance of the normal distribution of class 1
Titterington, D.M., Smith, A.F.M. & Makov, U.E. (1985). Statistical analysis of finite mixture distributions, Wiley, 1985. pages 86/87, example 4.3.2
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
data("fulmarin")
result <- gendis(population = "population", sex = "sex",
measurements = c("HB","BD2","TL","CL"), verbose = FALSE , data=fulmarin )
data("JanMayenBirds")
#get the measurements in the generalized discriminant function (GFD) from the new data
newdata <- as.matrix(JanMayenBirds[, c("HB","BD2","TL","CL")])
# combine the measurements using the coefficients of the GDF
GDFscores <- newdata%*% result$GDF[,2]
attr(GDFscores,which = "classnames") <- result$classnames
# note the attribute classnames with the names to be used in the printout
# for first and second level of the factor sex
# Calculate the cutpoint using unmix instead of predict.gendis
unmix(GDFscores,verbose = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.