Gaussian Mixture Model with a Uniform Noise Component
Source:R/uniformNoiseGMM.R
uniformNoiseGMM.RdFits, by maximum likelihood (EM), a Gaussian mixture with an additional uniform "noise" component of density `lambda0 / V` capturing outliers, as in the noise-component model of `mclust` (Banfield & Raftery 1993). Each observation's posterior probability of the noise component can be used as an outlier score.
Usage
uniformNoiseGMM(
x,
lambda = NULL,
mu = NULL,
sigma = NULL,
lambda0 = NULL,
V = NULL,
tol = 1e-06,
maxiter = 1000,
verbose = FALSE,
keep.data = FALSE
)Arguments
- x
`numeric(n)` - A numeric vector of observations
- lambda
`numeric` - Vector of mixing proportions of each normal component
- mu
`numeric` - Vector of means of each normal component
- sigma
`numeric` - Vector of standard deviations of each normal component
- lambda0
Initial mixing proportion of the uniform noise component. `sum(lambda) + lambda0` must be 1.
- V
Hyper-volume of the data region; defaults to `max(x) - min(x)`.
- tol
Convergence tolerance on the change in beta-likelihood.
- maxiter
Max iteration.
- verbose
Print iteration progress.
- keep.data
Keep a copy of `x` in the returned object.
Value
A list with elements `lambda`, `mu`, `sigma`, `lambda0`, `V`, `l` (log-likelihood), `iter`, and `converged`. If `maxiter` is reached before convergence, the last iterate is returned with `converged = FALSE` and a warning.
Examples
set.seed(404)
x <- rnormix(100, c(0.25, 0.75), c(0, 4), c(1, 1))
x[which.max(x)] <- 20 # outlier
uniformNoiseGMM(x, c(0.2475, 0.7425), c(0, 4), c(1, 1), lambda0 = 0.01)
#> $lambda
#> [1] 0.2951481 0.6879136
#>
#> $mu
#> [1] 0.3020328 4.0091712
#>
#> $sigma
#> [1] 1.2468809 0.8471066
#>
#> $lambda0
#> [1] 0.01693827
#>
#> $V
#> [1] 22.17879
#>
#> $l
#> [1] -196.0319
#>
#> $iter
#> [1] 40
#>
#> $converged
#> [1] TRUE
#>