Learn R Programming

ICS (version 1.4-1)

cov4.wt: Weighted Scatter Matrix based on Fourth Moments

Description

Estimates the weighted scatter matrix based on the 4th moments of the data.

Usage

cov4.wt(x, wt = rep(1/nrow(x), nrow(x)), location = TRUE,
        method = "ML", na.action = na.fail)

Value

A matrix containing the estimated weighted fourth moments scatter.

Arguments

x

numeric data matrix or dataframe.

wt

numeric vector of non-negative weights. At least some weights must be larger than zero.

location

TRUE if the weighted location vector should be computed. FALSE when taken wrt to the origin. If numeric the matrix is computed wrt to the given location.

method

Either ML or unbiased. Will be passed on to cov.wt when the Mahalanobis distance is computed.

na.action

a function which indicates what should happen when the data contain 'NA's. Default is to fail.

Author

Klaus Nordhausen

Details

If location = TRUE, then the scatter matrix is given for a \(n \times p\) data matrix X by $$\frac{1}{p+2} ave_{i}\{w_i[(x_{i}-\bar{x}_w)S_w^{-1}(x_{i}-\bar{x}_w)'](x_{i}-\bar{x}_w)'(x_{i}-\bar{x}_w)\},$$ where \(w_i\) are the weights standardized such that \(\sum{w_i}=1\), \(\bar{x}_w\) is the weighted mean vector and \(S_w\) the weighted covariance matrix. For details about the weighted mean vector and weighted covariance matrix see cov.wt.

See Also

cov4, cov.wt

Examples

Run this code
cov.matrix.1 <- matrix(c(3,2,1,2,4,-0.5,1,-0.5,2), ncol=3)
X.1 <- rmvnorm(100, c(0,0,0), cov.matrix.1)
cov.matrix.2 <- diag(1,3)
X.2 <- rmvnorm(50, c(1,1,1), cov.matrix.2)
X <- rbind(X.1, X.2)

cov4.wt(X, rep(c(0,1), c(100,50)))
cov4.wt(X, rep(c(1,0), c(100,50)))

Run the code above in your browser using DataLab