Solved – Two sample test for both equal variance and mean

hypothesis testingsamplet-test

For two normally distributed samples, is there a way to test for $H_0: \mu_1=\mu_2$ and also $\sigma_1^2=\sigma_2^2$. I have computed the likelihood ratio, but cannot recognize the underlying distribution.

Best Answer

You could do a likelihood ratio test. Calculate the MLE for each data set separately:

$$ L_1 \equiv \max_{\mu_{1}, \sigma_{1}} L_{1}(\mu_{1}, \sigma_{1}) $$

$$ L_2 \equiv \max_{\mu_{2}, \sigma_{2}} L_{2}(\mu_{2}, \sigma_{2}) $$

where $L_1$ is the log-likelihood function for the first data set and $L_2$ is the log-likelihood function for the second. Then, if the two data sets are independent, the maximized log-likelihood for the full data set (i.e. the two data sets together) is $L_1 + L_2$. This is the maximized log-likelihood when the two data sets are not restricted to having the same mean and variance.

Now, to get the MLE under the constraint that the two populations do have the same mean, you calculate

$$ L_{0} = \max_{\mu, \sigma} L(\mu, \sigma) $$

where $L$ is the log-likelihood function for the full data set. Then, under the null hypothesis you specified in your question,

$$ \lambda = 2 \bigg( (L_1 + L_2) - L_0 \bigg) $$

has an approximate (i.e. asymptotic) $\chi^2$ distribution on 2 degrees of freedom, assuming that the null hypothesis being tested doesn't include $\sigma_1 = \sigma_2 = 0$, which clearly can't be the case if you observe non-zero variance in your data. You can use that null distribution for significance testing.

Note: The joint MLE for the normally distributed data is the sample mean:

$$ \hat{\mu} = \frac{1}{n} \sum_{i=1}^{n} X_i $$

and the sample variance:

$$ \hat{\sigma}^{2} = \frac{1}{n} \sum_{i=1}^{n} (X_i-\hat{\mu})^2$$