# Fitting mixture distributions and probability estimation

I am working on continuous data set with ranges 0-1. I need to group them using mixed models (based on prior clinical/biological basis). From this model, I need to get the p-value for a value (say 0.52) to be in the dist1(red), dist2(blue) or dist3(green). What stat methods, packages would you recommend?

I fitted the distributions using mixtools by defining the number of distributions, what is the state of the art method to derive this in an unsupervised way?

• I do not know about the "state-of-the-art" (which is not necessarily widey tested) but the standard way is to use an information criterion (eg. AIC) and/or bootstrap your sample to get some confidence limits about your final estimate $k$. In addition, are you use that a KDE won't do a better job? Why enforce a parametric model in this case? – usεr11852 Feb 14 '16 at 20:10

## 1 Answer

This answer might be a bit late, but in case it helps anyone, here it goes:

An important aspect is of the mixtool package is that each input data point is actually assigned a posterior probability of belonging to one of the components that you have selected a priory (in your case 3, according to your graph). We can retrieve the data by using the following code:

yourdata <- as.data.frame(cbind(x = mixmdl$$x, mixmdl$$posterior))
head(post.df, 10)  # Retrieve first 10 rows


And you will see the probabilities of each data point to belong to the first, second or third distribution.

An example of the probabilities for each data point in a 2 distribution to belong to the first or second distribution:

##     x          comp.1         comp.2
## 1  79 0.0001030875283 0.999896912472
## 2  54 0.9999093397312 0.000090660269
## 3  74 0.0041357268361 0.995864273164
## 4  62 0.9673819082244 0.032618091776
## 5  85 0.0000012235720 0.999998776428
## 6  55 0.9998100114503 0.000189988550
## 7  88 0.0000001333596 0.999999866640
## 8  85 0.0000012235720 0.999998776428
## 9  51 0.9999901530788 0.000009846921
## 10 85 0.0000012235720 0.999998776428


Data extracted from http://tinyheero.github.io/2015/10/13/mixture-model.html) You might find the link very useful