FCP_TPA {MFPCA} | R Documentation |
The functional CP-TPA algorithm
Description
This function implements the functional CP-TPA (FCP-TPA) algorithm, that
calculates a smooth PCA for 3D tensor data (i.e. N
observations of 2D
images with dimension S1 x S2
). The results are given in a
CANDECOMP/PARAFRAC (CP) model format
X = \sum_{k = 1}^K d_k \cdot u_k
\circ v_k \circ w_k
where
\circ
stands for the outer product, d_k
is a scalar and
u_k, v_k, w_k
are eigenvectors for each direction of the tensor. In
this representation, the outer product v_k \circ w_k
can
be regarded as the k
-th eigenimage, while d_k \cdot u_k
represents the vector of individual scores for this eigenimage and each
observation.
Usage
FCP_TPA(
X,
K,
penMat,
alphaRange,
verbose = FALSE,
tol = 1e-04,
maxIter = 15,
adaptTol = TRUE
)
Arguments
X |
The data tensor of dimensions |
K |
The number of eigentensors to be calculated. |
penMat |
A list with entries |
alphaRange |
A list of length 2 with entries |
verbose |
Logical. If |
tol |
A numeric value, giving the tolerance for relative error values in
the algorithm. Defaults to |
maxIter |
A numeric value, the maximal iteration steps. Can be doubled,
if |
adaptTol |
Logical. If |
Details
The smoothness of the eigenvectors v_k, w_k
is induced by penalty
matrices for both image directions, that are weighted by smoothing parameters
\alpha_{vk}, \alpha_{wk}
. The eigenvectors u_k
are not smoothed,
hence the algorithm does not induce smoothness along observations.
Optimal smoothing parameters are found via a nested generalized cross
validation. In each iteration of the TPA (tensor power algorithm), the GCV
criterion is optimized via optimize
on the interval
specified via alphaRange$v
(or alphaRange$w
, respectively).
The FCP_TPA algorithm is an iterative algorithm. Convergence is assumed if
the relative difference between the actual and the previous values are all
below the tolerance level tol
. The tolerance level is increased
automatically, if the algorithm has not converged after maxIter
steps
and if adaptTol = TRUE
. If the algorithm did not converge after
maxIter
steps (or 2 * maxIter
) steps, the function throws a
warning.
Value
d |
A vector of length |
U |
A matrix of dimensions |
V |
A
matrix of dimensions |
W |
A matrix of dimensions |
References
G. I. Allen, "Multi-way Functional Principal Components Analysis", IEEE International Workshop on Computational Advances in Multi-Sensor Adaptive Processing, 2013.
See Also
Examples
# set.seed(1234)
N <- 100
S1 <- 75
S2 <- 75
# define "true" components
v <- sin(seq(-pi, pi, length.out = S1))
w <- exp(seq(-0.5, 1, length.out = S2))
# simulate tensor data with dimensions N x S1 x S2
X <- rnorm(N, sd = 0.5) %o% v %o% w
# create penalty matrices (penalize first differences for each dimension)
Pv <- crossprod(diff(diag(S1)))
Pw <- crossprod(diff(diag(S2)))
# estimate one eigentensor
res <- FCP_TPA(X, K = 1, penMat = list(v = Pv, w = Pw),
alphaRange = list(v = c(1e-4, 1e4), w = c(1e-4, 1e4)),
verbose = TRUE)
# plot the results and compare to true values
plot(res$V)
points(v/sqrt(sum(v^2)), pch = 20)
legend("topleft", legend = c("True", "Estimated"), pch = c(20, 1))
plot(res$W)
points(w/sqrt(sum(w^2)), pch = 20)
legend("topleft", legend = c("True", "Estimated"), pch = c(20, 1))