cwLocScat: Estimate location and scatter of data with cellwise weights

View source: R/cellwiseWeights.R

cwLocScatR Documentation

Estimate location and scatter of data with cellwise weights

Description

Computes different estimators of multivariate location and scatter for cellwise weighted data.

Usage

cwLocScat(X, W, methods = "all", lmin = 1e-3,
                     crit = 1e-12, maxiter= 1000, 
                     initCwCov = FALSE, initEst = NULL)

Arguments

X

An n by d data matrix or data frame. Must be given. X is allowed to contain NA's.

W

An n by d matrix of nonnegative cellwise weights. Must be given. W is not allowed to contain NA's.

methods

either "all" or "explicit". If "explicit" only the explicit estimates cwMean, cwCov and sqrtCov are computed. If "all" (the default) also the cellwise MLE is carried out, yielding cwMLEmu and cwMLEsigma.

lmin

if not NULL, a lower bound on the eigenvalues of the estimated covariance matrices on the standardized data, to avoid singularity.

crit

convergence criterion of successive mu and Sigma estimates in the EM algorithm.

maxiter

maximal number of iteration steps in EM.

initCwCov

if TRUE, uses the weighted mean and cwCov as initial estimates for the weighted EM.

initEst

if not NULL, a list with initial estimates $mu of the mean, $Sigma of the covariance matrix, for the weighted EM. Has no effect when initCwCov = TRUE.

Value

A list with components:

  • cwMean
    the explicit cellwise weighted mean.

  • cwCov
    explicit cellwise weighted covariance matrix. Is asymptotically normal but not necessarily PSD (unless a nonnegative lmin was specified).

  • sqrtCov
    the cellwise weighted covariance matrix of Van Aelst et al (2011). Also asymptotically normal but not necessarily PSD (unless a nonnegative lmin was specified).

  • cwMLEmu
    the location estimate obtained by the cwMLE.

  • cwMLEsigma
    the covariance matrix obtained by the cwMLE. Is PSD when the EM algorithm converges.

Author(s)

P.J. Rousseeuw

References

P.J. Rousseeuw (2022). Analyzing cellwise weighted data, ArXiv:2209.12697. (link to open access pdf)

See Also

weightedEM, unpack

Examples

data("data_personality_traits")
X <- data_personality_traits$X
W <- data_personality_traits$W
fit <- cwLocScat(X, W)
fit$cwMLEiter # number of iteration steps taken
round(fit$cwMLEmu, 2)
round(fit$cwMean, 2)
round(fit$cwMLEsigma, 2)
round(fit$cwCov, 2)


# For more examples, we refer to the vignette:
## Not run: 
vignette("cellwise_weights_examples")

## End(Not run)

cellWise documentation built on Oct. 25, 2023, 5:07 p.m.