Skip to contents

Empirical Cramer-von Mises divergence between the data and the model fitted by [robustGMM()], computed by leave-one-out cross-validation. Useful for data-driven selection of the tuning parameter `beta`: pick the `beta` minimizing this divergence over a grid.

Usage

loo_cvm_div(x, lambda, mu, sigma, beta = 0.2, tol = 1e-05, maxiter = 1000)

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.

Value

`numeric(1)` - the mean squared discrepancy between the empirical CDF position `(i - 0.5) / N` and the fitted mixture CDF at each held-out observation.

Examples

set.seed(404)
x <- rnormix(50, c(0.25, 0.75), c(0, 4), c(1, 1))
loo_cvm_div(x, c(0.25, 0.75), c(0, 4), c(1, 1), beta = 0.1)
#> [1] 0.0004784877