weighted.scale {corpcor} | R Documentation |
weighted.var
estimate the unbiased variance taking into account
data weights.
weighted.moments
produces the weighted mean and weighted variance
for each column of a matrix.
weighted.scale
centers and standardized a matrix using
the weighted mean and variance.
weighted.var(xvec, w) weighted.moments(x, w) weighted.scale(x, w, center=TRUE, scale=TRUE, wm)
xvec |
a vector |
x |
a matrix |
w |
data weights |
center |
logical value |
scale |
logical value |
wm |
list with variances and means as returned by weighted.moments .
Will be computed from x if missing. |
A rescaled matrix (weighted.scale
), a list containing the column means and
variances (weighted.moments
), or simple number (weighted.var
)
Rainer Opgen-Rhein (http://www.statistik.lmu.de/~opgen/) and Korbinian Strimmer (http://www.statistik.lmu.de/~strimmer/).
# load corpcor library library("corpcor") # generate some data p <- 5 n <- 5 X <- matrix(rnorm(n*p), nrow = n, ncol = p) w <- c(1,1,1,3,3)/9 # standardize matrix scale(X) weighted.scale(X) weighted.scale(X, w) # take into account data weights