Skip to contents

Fits a univariate Gaussian mixture model by maximizing the density power (beta-)divergence induced likelihood of Fujisawa & Eguchi (2006) with an EM-type algorithm. `beta = 0` corresponds to the usual maximum likelihood estimator; larger `beta` down-weights outliers.

Usage

robustGMM(
  x,
  lambda = NULL,
  mu = NULL,
  sigma = NULL,
  beta = 0.2,
  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

beta

`numeric(1)` - parameter corresponds to the beta-divergence induced likelihood

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`, `beta`, `l_beta`, `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)] <- 10 # outlier
robustGMM(x, c(0.25, 0.75), c(0, 4), c(1, 1), beta = 0.2)
#> $lambda
#> [1] 0.2930384 0.7069616
#> 
#> $mu
#> [1] 0.2278039 3.9918952
#> 
#> $sigma
#> [1] 1.2255239 0.8846287
#> 
#> $beta
#> [1] 0.2
#> 
#> $l_beta
#> [1] 2.845144
#> attr(,"abs.error")
#> [1] 5.244559e-13
#> 
#> $iter
#> [1] 23
#> 
#> $converged
#> [1] TRUE
#>