Let’s say we want to find a symple model where $y \sim N(\mu_i, \sigma_i^2)$ where the probability of i-th point to belong to cluster 1 is denoted by $\eta_i$ and the cluster variable is denoted by $\alpha_i$. Simulate some data
Fit a simple normal mixture mode
Classify data points
Mixture models can also be used for classification tasks. Given a point $y$ we can ask $P(\alpha_i = 1)$ ?
What’s our predictive distribution? It’s a weighted average of the means from each cluster.
we can also extract the probabilities $\eta_i$ for each point.
Model the latent variable
The probability $eta_i$ is usually a function of the covariates. So the observable model is the same, $y \sim N(\mu_i, \sigma_i^2)$, but $\text{logit}(p) = \eta(x)$.
Create a model where $\eta = A + B \cdot x$
create
Find the probability of belonging to each cluster
and plot the marginal effect of $x$ on the probability of cluster