cov.wml | R Documentation |
Returns a list containing estimates of the weighted covariance
matrix and the mean of the data, and optionally of the (weighted)
correlation matrix. The
covariance matrix is divided by the sum of the weights,
corresponding to n
and the ML-estimator in the case of equal
weights, as opposed to n-1
for cov.wt
.
cov.wml(x, wt = rep(1/nrow(x), nrow(x)), cor = FALSE, center = TRUE)
x |
a matrix or data frame. As usual, rows are observations and columns are variables. |
wt |
a non-negative and non-zero vector of weights for each
observation. Its length must equal the number of rows of
|
cor |
A logical indicating whether the estimated correlation weighted matrix will be returned as well. |
center |
Either a logical or a numeric vector specifying the centers
to be used when computing covariances. If |
A list containing the following named components:
cov |
the estimated (weighted) covariance matrix. |
center |
an estimate for the center (mean) of the data. |
n.obs |
the number of observations (rows) in |
wt |
the weights used in the estimation. Only returned if given as an argument. |
cor |
the estimated correlation matrix. Only returned if ‘cor’ is ‘TRUE’. |
Christian Hennig christian.hennig@unibo.it https://www.unibo.it/sitoweb/christian.hennig/en/
cov.wt
, cov
, var
x <- c(1,2,3,4,5,6,7,8,9,10)
y <- c(1,2,3,8,7,6,5,8,9,10)
cov.wml(cbind(x,y),wt=c(0,0,0,1,1,1,1,1,0,0))
cov.wt(cbind(x,y),wt=c(0,0,0,1,1,1,1,1,0,0))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.