mixTest {MixSemiRob}R Documentation

Goodness of Fit Test for Finite Mixture Models

Description

‘mixTest’ is used to perform a goodness-of-fit test for finite mixture models (Wichitchan et al., 2019). It returns five types of goodness-of-fit statistics and determines the number of components in the mixture model based on the Kolmogorov-Smirnov (KS) statistic. The test is performed using bootstrapping.

Usage

mixTest(x, alpha = 0.10, C.max = 10, nboot = 500, nstart = 5)

Arguments

x

a vector of observations.

alpha

significance level of the test.

C.max

maximum number of mixture components considered in the test. The test is performed for 2 to C.max components.

nboot

number of bootstrap resampling. Default is 500.

nstart

number of initializations to try. Default if 5.

Value

A list containing the following elements:

GOFstats

vector of test statistics calculated from data, in the order of c(ks, cvm, kui, wat, ad).

ks

vector of the Kolmogorov-Smirnov (KS) statistic for each bootstrap sample.

cvm

vector of the Cramer-Von Mises statistic for each bootstrap sample.

kui

vector of the Kuiper's statistic for each bootstrap sample.

wat

vector of the Watson statistic for each bootstrap sample.

ad

vector of the Anderson Darling statistic for each bootstrap sample.

result

vector of test results based on the KS statistic. If the kth element in the vector is 1, k-component mixture model is significant based on the KS statistic; If 0, otherwise. See examples for details.

References

Wichitchan, S., Yao, W., and Yang, G. (2019). Hypothesis testing for finite mixture models. Computational Statistics & Data Analysis, 132, 180-189.

Examples

n = 100
mu = c(-2.5, 0)
sd = c(0.8, 0.6)
n1 = rbinom(n, 1, 0.3)
x = c(rnorm(sum(n1), mu[1], sd[1]), rnorm(n - sum(n1), mu[2], sd[2]))

# The result shows that two-component mixture model is statistically significant based on the KS.
out = mixTest(x, alpha = 0.10, C.max = 10, nboot = 500, nstart = 5)

[Package MixSemiRob version 1.1.0 Index]