% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/princ.R
\name{princ}
\alias{princ}
\title{Principal Component Analysis of Y with possible missing elements}
\usage{
princ(Y, ndim = 1, estmu = 1, maxiter = 1000, eps = 1e-08, init = 1, print = 1)
}
\arguments{
\item{Y}{matrix of n x p}

\item{ndim}{# of dimensions: Must be less than or equal to p.}

\item{estmu}{= 0 not to estimate mu  (No standardization of Y)}

\item{maxiter}{Maximum # of iterations for missing elements}

\item{eps}{criterion for convergence}

\item{init}{= 0 to use random number as the first estimate of missing\cr
= 1 to use the gramd mean \cr
= 2 to use the column mean}

\item{print}{= 1 to print the result}
}
\value{
A list of:\cr
Yhat=1mu'-FA', F, A, mu, iter, eps, rmse=sqrt(RSS)
}
\description{
Principal Component Analysis of Y with possible missing elements
}
\details{
This function minimizes the following RSS \cr
     RSS = tr( ( Y - 1 mu' - F A')'( Y - 1 mu' - F A') ) \cr
where mu is the p x 1 vector, \cr
F is the n x ndim orthonormal score matrix, \cr
and A is the p x ndim matrix of loadings.
}
\examples{
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)
}
