[R] mixtools' normalmixEM find cut-off between populations are reproduce graph

Luigi Marongiu m@rong|u@|u|g| @end|ng |rom gm@||@com
Wed Jun 12 11:15:18 CEST 2019


Dear all,
I am using mixtools' normalmixEM to find a cut-off that can separate
two populations. I can run the model, but I have two problems:
1. how do I find the value that separates the two populations? The
model provides two density plots, what would be the value that is at
the intersection between the two distribution and that constitutes the
best cut-off?
2. is it possible to reproduce the plots given by normalmixEM using
basic R functions?

Here is an example:
>>>
pos = rnorm(100, mean = 1, sd = 1)
neg = rnorm(100, mean = 0, sd = 3)
X = c(pos, neg)
dX = density(X)
dp = density(pos)
dn = density(neg)
plot(dX)
points(dp, type = "l", col = "green")
points(dn, type = "l", col = "red")
library(mixtools)
model = normalmixEM((x = X))
print(summary(model))
muneg = model$mu[1]       # Mean of negative population
sdneg = model$sigma[1]    # SD of negative population
mupos = model$mu[2]       # Mean of positive population
sdpos = model$sigma[2]    # SD of positive population
plot(model, which=2)
abline(v=0.058, lty = 2, col = "blue", lwd = 2)
<<<

the first plot shows that the two populations (pos and neg) are
distinct since their mean values are shifted one another. The second
plot reproduces this distinction and the intersection point between
the red (neg) and green (pos) distributions should be the cut-off
between the populations. in this case, I find it manually at 0.058
(blue line). How can I calculate it properly?
Thank you.

-- 
Best regards,
Luigi



More information about the R-help mailing list