# EM Algorithm Derivation, Discrete Case

Cross Validated Asked on December 27, 2021

Just wanted to ask whether the following derivation is correct:

Suppose $$X$$ is a vector of observed random variables, $$Z$$ is a vector of unobserved random variables and $$theta$$ is a vector of parameters. Let $$S$$ be the set of values $$Z$$ could take on; we’ll assume this is discrete. We’ll also assume the following are known

$$f(x|z,theta)$$ = the probability density function of X given Z and theta
$$P(Z=z|theta)$$ = the probability that $$Z=z$$ given $$theta$$

The likelihood function I want is

$$prod_{zin S}[f(x|z,theta)P(Z=z|theta)]^{1_{Z=z}}$$

Taking the logarithm:

$$sum_{zin S}1_{Z=z}[log f(x|z,theta)+log P(Z=z|theta)]$$

Now suppose I’m performing the EM algorithm and my current estimate of $$theta$$ is $$theta^{(n)}$$. Then I need to apply $$E_{Z|theta^{(n)},x}$$ to the above expression. This gives:

$$sum_{zin S}P(Z=z|theta^{(n)})[log f(x|z,theta)+log P(Z=z|theta)]$$

That is the expression I need to maximize with respect to $$theta$$ in the M step.

Is that correct, or did I make a mistake somethere? Thanks

Yes, your derivation looks correct. Just a minor clarification in the final expression -

In the expression, $$sum_{zin S}P(Z=z|x,theta^{(n)})[log f(|z,theta)+log P(Z=z|theta)]$$, the term $$P(Z=z|x,theta^{(n)})$$ would be computed in Expectation step; hence, during the maximization step, it is treated as constant value. In the M-step, derivatives are computed for only the terms within the bracket.

## Related Questions

### Capacity of neural network with one hidden neuron?

1  Asked on November 24, 2021

### What does Y-axis of Normal Distribution’s plot denote?

2  Asked on November 24, 2021 by dmittal

### Confidence intervals and multiple regression for a multiply imputed data set

2  Asked on November 24, 2021 by appleseed

### Universal approximation theorem on limited precision arithmetic

0  Asked on November 24, 2021 by mrmartin

### Intercept interpretation in multi-level model when first-level predictor discrete

1  Asked on November 24, 2021

### Factors given by DoE can experimentally not be reached

0  Asked on November 24, 2021

### Why should we compare estimates of generalized linear model with its corresponding standard errors?

3  Asked on November 24, 2021

### Is it possible to view sequential independent trials as pre-determined with unknown outcome?

1  Asked on November 24, 2021 by jack-arthur

### Interpret coefficient of negative binomial regression

1  Asked on November 24, 2021

### Gaussian process smoothers (bs = “gp”) in GAMs

0  Asked on November 24, 2021 by doug-sponsler

### simulation of logistic regression sensitivity to prior probability: Brier score vs accuracy

0  Asked on November 24, 2021

### What is the best structure (Accuracy of the text extracted) for building an OCR? ATTENTION, CRNNN, DRAM,RAM, CTC based

0  Asked on November 24, 2021

### Nearest-neighbor returns different results based on coordinates chosen

0  Asked on November 24, 2021 by zhutchens1

### Counterexample where E(u|x)=0 in a regression model cannot hold in the population?

1  Asked on November 24, 2021

### report output GLMER and do contrasts

0  Asked on November 24, 2021 by chiara-toschi

### How determine the bandwidth of a gaussian kernel such that k nearest points represent a certain % of sum weight

1  Asked on November 24, 2021 by tzirtzi

### Comparing ISOMAP residual variance to PCA explained variance

1  Asked on November 21, 2021 by user3358740

### How to optimize Gaussian-process parameters for multiple tasks with GPML?

1  Asked on November 21, 2021 by scott-thibault

### For conjoint attribute importance calculation, should insignificant attribute levels be included in the calculation?

1  Asked on November 21, 2021 by arctan27

### Multilevel Poisson Regression

1  Asked on November 21, 2021