I would appreciate some help getting some EM stuff straight. So, say I generate data in R as follows:
N <- 100
epsilon <- rnorm(N)
X <- 10*runif(N)
beta.0 <- 10
beta.1 <- 3
sigma <- 2
Y <- beta.0 + beta.1 * X + sigma * epsilon
epsilon2 <- rnorm(N)
X2 <- 10*runif(N)
Y2 <- 3 - X2 + 0.25 * epsilon2
Y.mix <- c(Y, Y2)
X.mix <- c(X, X2)
Now, in expectation maximization, in the first step, I have some prior probability, say 0.5, of the data being from either one or the other distribution. So, using EM I know I can estimate the mean and variance of the two mixtures. From looking at a density plot, it seems like the means are at about -2 and 30 for the data I simulated. But, at what stage in EM do I back out the betas? I want to recover the slope, intercept, and sd deviation parameters for the 2 regression-type equations.
Thanks for an clarification.