Difference in 2 groups when group assignment is not certain Suppose you have two groups and you want to see whether these two groups differ in regards to some variable. This sounds like a basic t-test or perhaps non-parametric Wilcoxon rank sum test. 
Suppose that the group membership is fuzzy. For example, for each sample, you have some probability that it belongs to group 1 (e.g. $p_1$) and some probability it belongs to group 2 ($p_2=1-p_1$). What are some approaches you can take to determine whether these two groups differ in their outcome variable (say $Y$).
First thing I thought about was a linear mixed effects model. What are some other approaches to this? Pros and cons? 
 A: We have data in the form $\{y_i, p_i\}_{i=1,\dots,n}$ where $p_i$ is the probability that $y_i \sim F_1$ and $1-p_i$ is the probability that $y_i \sim F_2$. We introduce a latent parameter $\lambda_i$ such that
\begin{align}
y_i \mid \lambda_i = k &\sim F_k,
\end{align}
which is equivalent to the model specification we started with when
\begin{align}
\mathbb{P}(\lambda_i = 1) &= p_i\\
\mathbb{P}(\lambda_i = 2) &= 1- p_i
\end{align}
Observe that if we know $\boldsymbol\lambda$, then we know which $\mathbf{y}$ came from $F_k$. Denote these as $\mathbf{y}^{(k)}$. Suppose also we can calculate the posterior of $F_k \mid \mathbf{y}^{(k)}$ through some method (e.g., conjugacy).
Using total probability, we can write
\begin{align}
\pi(F_k \mid \mathbf{y}) &= \mathbb{E}_{\boldsymbol\lambda}[\pi(F_k \mid \boldsymbol \lambda, \mathbf{y})]\\
&= \mathbb{E}_{\boldsymbol\lambda}[\pi(F_k \mid \mathbf{y}^{(k)})]\\
&= \sum_{\boldsymbol \lambda \in \boldsymbol \Lambda} \mathbb{P}(\boldsymbol \lambda) \pi(F_k \mid \mathbf{y}^{(k)}),
\end{align}
where we write $\boldsymbol \Lambda$ to denote the set of all binary $n$-tuples $\boldsymbol \lambda$ can take on (e.g., $\lambda_1 = 0, \lambda_2 = 1,\dots$). This result is enough to get us what we need, since
$$
\mathbb{P}(\boldsymbol \lambda) = \prod_{i=1}^n p_i^{I\{\lambda_i = 1\}} (1-p_i)^{I\{\lambda_i = 2\}}.
$$
In all, this gives us
$$
\pi(F_k \mid \mathbf{y}) = \sum_{\boldsymbol \lambda \in \boldsymbol \Lambda}\left[ \left( \prod_{i=1}^n p_i^{I\{\lambda_i = 1\}} (1-p_i)^{I\{\lambda_i = 2\}} \right) \pi(F_k \mid \mathbf{y}^{(k)})  \right].
$$
Using Monte Carlo, inference isn't so bad. For example,


*

*Assign $\lambda_i$ at random according to probability $p_i$

*Group each $y_i$ based on the simulation of $\lambda_i$ into $\mathbf{y}^{(k=1,2)}$

*Draw from the posterior of $\pi(F_k \mid \mathbf{y}^{(k)})$ for each $k=1,2$.

*Repeat


Then we can use the posterior draws obtained in step 3 as approximate draws from the posterior $\pi(F_k \mid \mathbf{y})$. These posterior draws should be able to answer the typical questions of interest..
