cov4.wt {ICS} | R Documentation |
Estimates the weighted scatter matrix based on the 4th moments of the data.
cov4.wt(x, wt = rep(1/nrow(x), nrow(x)), location = TRUE, method = "ML", na.action = na.fail)
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. |
If location = TRUE
, then the scatter matrix is given for a n x p data matrix X by
1/(p+2) ave{w_i[(x_i-x_bar)S^{-1}(x_i-x_bar)'] (x_i-x_bar)'(x_i-x_bar)},
where w_i are the weights standardized such that sum(w_i)=1,
x_bar is the weighted mean vector and S the weighted covariance matrix.
For details about the weighted mean vector and weighted covariance matrix see cov.wt
.
A matrix.
Klaus Nordhausen, klaus.nordhausen@uta.fi
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)))