princ {lazy.tools} | R Documentation |
Principal Component Analysis of Y with possible missing elements
princ(Y, ndim = 1, estmu = 1, maxiter = 1000, eps = 1e-08, init = 1, print = 1)
Y |
matrix of n x p |
ndim |
# of dimensions: Must be less than or equal to p. |
estmu |
= 0 not to estimate mu (No standardization of Y) |
maxiter |
Maximum # of iterations for missing elements |
eps |
criterion for convergence |
init |
= 0 to use random number as the first estimate of missing |
print |
= 1 to print the result |
This function minimizes the following RSS
RSS = tr( ( Y - 1 mu' - F A')'( Y - 1 mu' - F A') )
where mu is the p x 1 vector,
F is the n x ndim orthonormal score matrix,
and A is the p x ndim matrix of loadings.
A list of:
Yhat=1mu'-FA', F, A, mu, iter, eps, rmse=sqrt(RSS)
n <- 20; np <- 5; pmiss <- 0.1
Y <- matrix( rnorm(n*np),n )
Y[which(matrix(runif(n*np),n,np) < pmiss)]=NA
princ(Y,2, print=10, estmu=1, init=1)