Description Usage Arguments Value Examples
Root mean-squared error is the square root of the element-wise error's mean.
This is a useful quantity to display during parameter estimation in pca_updates
since it is a measure of how well the PCA projection is fitting the data.
1 | compute_rms(X, A, S, M, ndata, verbose = TRUE)
|
X |
|
A |
|
S |
|
M |
|
ndata |
|
verbose |
|
A list
of length 2:
matrix
– matrix of element-wise differences (errors)
between the observed data and the PCA projection.
numerical
– root mean-squared error of the PCA
projection.
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)
init.model <- initParms(p=p, n=n, ncomp=2, verbose = TRUE)
compute_rms(X=X, A=init.model$A, S=init.model$S, M=M, ndata=sum(Nobs_i), verbose=TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.