# test.equality: Performs Chi-Square Tests for Scale and Location Mixtures In mixtools: Tools for Analyzing Finite Mixture Models

## Description

Performs a likelihood ratio test of a location (or scale) normal or regression mixture versus the more general model. For a normal mixture, the alternative hypothesis is that each component has its own mean and variance, whereas the null is that all means (in the case of a scale mixture) or all variances (in the case of a location mixture) are equal. This test is asymptotically chi-square with degrees of freedom equal to k-1, where k is the number of components.

## Usage

 ```1 2 3``` ```test.equality(y, x = NULL, arbmean = TRUE, arbvar = FALSE, mu = NULL, sigma = NULL, beta = NULL, lambda = NULL, ...) ```

## Arguments

 `y` The responses for `regmixEM` or the data for `normalmixEM`. `x` The predictors for `regmixEM`. `arbmean` If FALSE, then a scale mixture analysis is performed for `normalmixEM` or `regmixEM`. `arbvar` If FALSE, then a location mixture analysis is performed for `normalmixEM` or `regmixEM`. `mu` An optional vector for starting values (under the null hypothesis) for `mu` in `normalmixEM`. `sigma` An optional vector for starting values (under the null hypothesis) for `sigma` in `normalmixEM` or `regmixEM`. `beta` An optional matrix for starting values (under the null hypothesis) for `beta` in `regmixEM`. `lambda` An otional vector for starting values (under the null hypothesis) for `lambda` in `normalmixEM` or `regmixEM`. `...` Additional arguments passed to the various EM algorithms for the mixture of interest.

## Value

`test.equality` returns a list with the following items:

 `chi.sq` The chi-squared test statistic. `df` The degrees of freedom for the chi-squared test statistic. `p.value` The p-value corresponding to this likelihood ratio test.

`test.equality.mixed`
 ```1 2 3 4 5 6``` ```## Should a location mixture be used for the Old Faithful data? data(faithful) attach(faithful) set.seed(100) test.equality(y = waiting, arbmean = FALSE, arbvar = TRUE) ```