This function aligns a collection of functions while extracting principal components.
align_fPCA(
f,
time,
num_comp = 3L,
showplot = TRUE,
smooth_data = FALSE,
sparam = 25L,
parallel = FALSE,
cores = NULL,
max_iter = 51L,
lambda = 0
)
A list with the following components:
f0
: A numeric matrix of shape \(M \times N\) storing the original
functions;
fn
: A numeric matrix of the same shape as f0
storing the aligned
functions;
qn
: A numeric matrix of the same shape as f0
storing the aligned
SRSFs;
q0
: A numeric matrix of the same shape as f0
storing the SRSFs of the
original functions;
mqn
: A numeric vector of length \(M\) storing the mean SRSF;
gam
: A numeric matrix of the same shape as f0
storing the estimated
warping functions;
vfpca
: A list storing information about the vertical PCA with the
following components:
q_pca
: A numeric matrix of shape \((M + 1) \times 5 \times
\mathrm{num\_comp}\) storing the first \(3\) principal directions in SRSF
space; the first dimension is \(M + 1\) because, in SRSF space, the
original functions are represented by the SRSF and the initial value of the
functions.
f_pca
: A numeric matrix of shape \(M \times 5 \times
\mathrm{num\_comp}\) storing the first \(3\) principal directions in
original space;
latent
: A numeric vector of length \(M + 1\) storing the singular
values of the SVD decomposition in SRSF space;
coef
: A numeric matrix of shape \(N \times \mathrm{num\_comp}\)
storing the scores of the \(N\) original functions on the first
num_comp
principal components;
U
: A numeric matrix of shape \((M + 1) \times (M + 1)\) storing the
eigenvectors associated with the SVD decomposition in SRSF space.
Dx
: A numeric vector of length max_iter
storing the value of the cost
function at each iteration.
A numeric matrix of shape \(M \times N\) specifying a sample of \(N\) \(1\)-dimensional curves observed on a grid of size \(M\).
A numeric vector of length \(M\) specifying the grid on which
functions f
have been evaluated.
An integer value specifying the number of principal
components to extract. Defaults to 3L
.
A boolean specifying whether to display plots along the way.
Defaults to TRUE
.
A boolean specifying whether to smooth data using box
filter. Defaults to FALSE
.
An integer value specifying the number of times to apply box
filter. Defaults to 25L
. This argument is only used if smooth_data == TRUE
.
A boolean specifying whether computations should run in
parallel. Defaults to FALSE
.
An integer value specifying the number of cores to use for
parallel computations. Defaults to NULL
in which case it uses all
available cores but one. This argument is only used when parallel == TRUE
.
An integer value specifying the maximum number of iterations.
Defaults to 51L
.
A numeric value specifying the elasticity. Defaults to 0.0
.
Tucker, J. D., Wu, W., Srivastava, A., Generative models for functional data using phase and amplitude separation, Computational Statistics and Data Analysis (2012), 10.1016/j.csda.2012.12.001.
if (FALSE) {
out <- align_fPCA(simu_data$f, simu_data$time)
}
Run the code above in your browser using DataLab