Description Usage Arguments Value Examples
internal function within pca_full
to subtract the row means
from a matrix of data using only the observed values. Offers little utility
standalone.
1 | subtractMu(Mu, X, M, p, n, update_bias, verbose = TRUE)
|
Mu |
|
X |
|
M |
|
p |
|
n |
|
update_bias |
|
verbose |
|
X
matrix
– centered data matrix.
1 2 3 4 5 6 7 8 9 10 11 12 13 | p <- 20
n <- 7
set.seed(10045)
X <- matrix(rnorm(p*n), p, n)
miss.inds <- sample(1:(p*n), (p*n)/4)
X[miss.inds] <- NA
M <- !is.na(X)
Nobs_i <- rowSums(M)
Mu <- rowSums(X, na.rm = TRUE) / Nobs_i
update_bias <- TRUE
Xcent <- subtractMu(Mu=Mu, X=X, M=M, p=p, n=n, update_bias=update_bias, verbose=TRUE)
X-Xcent
Mu # all observed values in each column equal to Mu
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.