% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/procote.R
\name{procote}
\alias{procote}
\title{Extened Orthogonal Procrustes Rotation}
\usage{
procote(A, C, estm = 0, estd = 0, maxiter = 200, eps = 1e-06, print = 2)
}
\arguments{
\item{A}{The input matrix to be rotated}

\item{C}{The target matrix}

\item{estm}{= 1 to estimate column means}

\item{estd}{= 1 to estimate scaling constant}

\item{maxiter}{max # of iterations}

\item{eps}{convergence criterion for rmse}

\item{print}{= 0 to surpress the output}
}
\value{
A list of: \cr
B=d * A \%*\% T + matrix(1,nv,1)\%*\%t(m), \cr
 T, m, d, Cm the updated target matrix, rmse=sqrt(RSS)
}
\description{
Extened Orthogonal Procrustes Rotation
}
\details{
This program finds those A, m, d  and orthonormal T which minimize \cr
  \deqn{RSS = tr( ( C  - Chat )' ( C - Chat ) ) }\cr
  where \eqn{Chat = d * A \%*\% T + matrix(1,nv) \%*\% t(m)}, \cr
  \eqn{d} is a scalar, \eqn{T} is an orthonormal rotation matrix, \cr
  and \eqn{m} is the column mean vector. \cr
\cr
Note that when \code{estd=0} and \code{estm=0}
, and the target matrix does not
have missing elements, \cr
this is equivalent to the usual orthogonal Procrustes rotation.
}
\examples{
 set.seed(1701)
 nv <- 10; nr <- 2
 pmiss <- 0.3

 A <- matrix(rnorm(nv*nr),nv,nr)
 dum <- matrix(rnorm(nv*nr),nv,nr)
 T <- eigen(t(dum)\%*\%dum)[[2]]
 m <- matrix(rnorm(nr),nr,1)
 d <- 10*runif(1)
 C <- d*A\%*\%T + matrix(rep(1,nv),nv,1)\%*\%t(m)

 res <- procote( A, C, estm=0, estd=0, print=1 )
 res2 <- procote( A, C, estm=1, estd=1, print=1 )

 # missing elements in the target
 dum <- matrix(runif(nv*nr),nv,nr)
 C[which(dum < pmiss)] <- NA

 res3 <- procote( A, C, estm=0, estd=0, print=1 )
 res4 <- procote( A, C, estm=1, estd=1, print=1 )


}
