pca_by_als {lazy.fa} | R Documentation |
This program approximates the n x nvar input matrix Y
by the product of n x ndim F
and nvar x ndim A
matrices as
Y = F %*% t(A) + E
The optimal scaling of Y
can also be estimated.
pca_by_als(Y, ndim = 2, mlevel = 4, maxiter = 1000, epsd = 1e-06, SQUAREM = 0, nSQUAREM = 1, maxalpha = -1, always = 1, reset1 = 1, reset2 = 2, print = 1)
Y |
Data matrix |
ndim |
# of dimensions |
mlevel |
A vector of measurement level for each variable: |
maxiter |
Maximum # of iterations |
epsd |
The convergence criterion for the difference of param values. |
SQUAREM |
= 3 : See the help of iSQUAREM in lazy.accel package. |
nSQUAREM |
>= 1 # of iterations a which SQUAREM begins. |
maxalpha |
= -1 : See the help of iSQUAREM in lazy.accel package. |
always |
= 1 : See the help of iSQUAREM in lazy.accel package. |
reset1 |
= 0 : See the help of iSQUAREM in lazy.accel package. |
reset2 |
= 1 : See the help of iSQUAREM in lazy.accel package. |
print |
= 1 to print the result |
nknots |
# of knots for monotone spline transformation |
minalpha |
= -999 : See the help of iSQUAREM in lazy.accel package. |
This function finds F and A matrices of rank ndim which minimize
sum over j of( (Yhat[,j]-(F%*%t(A))[,j])^2 / var(Yhat[,j]) )
where Yhat
is the column-wise optimally scaled data matrix Y
.
The actual minimization is done by normalizing var(Yhat[,j])=1
and minimizing sum( (Yhat-F%*%A)^2 )
by alternating least squares..
seed <- 1701+9 set.seed(seed) n <- 100; nvar <- 25 Y <- matrix(rnorm(n*nvar),n) # res <- pca_by_als( Y, 2, SQUAREM=0, print=2, mlevel=5 ) # slow!! res <- pca_by_als( Y, 2, SQUAREM=3, always=1, print=2, mlevel=5 )