[R] Compare two normal to one normal

Charles C. Berry ccberry at ucsd.edu
Wed Sep 23 22:27:51 CEST 2015


On Tue, 22 Sep 2015, John Sorkin wrote:

> Charles,

> I am not sure the answer to me question, given a dataset, how can one 
> compare the fit of a model of the fits the data to a mixture of two 
> normal distributions to the fit of a model that uses a single normal 
> distribution, can be based on the glm model you suggest.

Well you *did* ask how to calculate the log-likelihood of a fitted normal 
density, didn't you? That is what I responded to. You can check that 
result longhand as sum( dnorm( y, y.mean, y.std , log=TRUE ) ) and get the 
same result (as long as you used ML estimates of the mean and standard 
deviation).

>
>
> I have used normalmixEM to fit the data to a mixture of two normal 
> curves. The model estimates four (perhaps five) parameters: mu1, sd^2 1, 
> mu2, sd^2, (and perhaps lambda, the mixing proportion. The mixing 
> proportion may not need to be estimated, it may be determined once once 
> specifies mu1, sd^2 1, mu2, and sd^2.) Your model fits the data to a 
> model that contains only the mean, and estimates 2 parameters mu0 and 
> sd0^2.  I am not sure that your model and mine can be considered to be 
> nested. If I am correct I can't compare the log likelihood values from 
> the two models. I may be wrong. If I am, I should be able to perform a 
> log likelihood test with 2 (or 3, I am not sure which) DFs. Are you 
> suggesting the models are nested? If so, should I use 3 or 2 DFs?

As Rolf points out there is a literature on such tests (and Googling 'test 
finite mixture' covers much of it).

Do you really want a test? If you merely want to pick a winner from two 
candidate models there are other procedures. k-fold crossvalidation 
of the loglikelihood ratio statistic seems like an easy, natural approach.

HTH,

Chuck



More information about the R-help mailing list