Performs Chi-Square Tests for Scale and Location Mixtures
test.equality.RdPerforms 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
test.equality(y, x = NULL, arbmean = TRUE, arbvar = FALSE,
mu = NULL, sigma = NULL, beta = NULL,
lambda = NULL, ...)Arguments
- y
The responses for
regmixEMor the data fornormalmixEM.- x
The predictors for
regmixEM.- arbmean
If FALSE, then a scale mixture analysis is performed for
normalmixEMorregmixEM.- arbvar
If FALSE, then a location mixture analysis is performed for
normalmixEMorregmixEM.- mu
An optional vector for starting values (under the null hypothesis) for
muinnormalmixEM.- sigma
An optional vector for starting values (under the null hypothesis) for
sigmainnormalmixEMorregmixEM.- beta
An optional matrix for starting values (under the null hypothesis) for
betainregmixEM.- lambda
An otional vector for starting values (under the null hypothesis) for
lambdainnormalmixEMorregmixEM.- ...
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.
Examples
## Should a location mixture be used for the Old Faithful data?
data(faithful)
attach(faithful)
#> The following objects are masked from faithful (pos = 3):
#>
#> eruptions, waiting
#> The following objects are masked from faithful (pos = 11):
#>
#> eruptions, waiting
#> The following objects are masked from faithful (pos = 12):
#>
#> eruptions, waiting
#> The following objects are masked from faithful (pos = 13):
#>
#> eruptions, waiting
set.seed(100)
test.equality(y = waiting, arbmean = FALSE, arbvar = TRUE)
#> number of iterations= 16
#> number of iterations= 22
#> $chi.sq
#> [1] 122.5741
#>
#> $df
#> [1] 1
#>
#> $p.value
#> [1] 0
#>