This function aligns a collection of \(1\)-dimensional curves that are observed on the same grid.
time_warping(
f,
time,
lambda = 0,
penalty_method = c("roughness", "geodesic", "norm"),
centroid_type = c("mean", "median"),
center_warpings = TRUE,
smooth_data = FALSE,
sparam = 25L,
parallel = FALSE,
cores = -1,
optim_method = c("DP", "DPo", "DP2", "RBFGS"),
max_iter = 20L
)
An object of class fdawarp
which is a list with the following
components:
time
: a numeric vector of length \(M\) storing the original grid;
f0
: a numeric matrix of shape \(M \times N\) storing the original
sample of \(N\) functions observed on a grid of size \(M\);
q0
: a numeric matrix of the same shape as f0
storing the original
SRSFs;
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;
fmean
: a numeric vector of length \(M\) storing the mean or median
curve;
mqn
: a numeric vector of length \(M\) storing the mean or median SRSF;
warping_functions
: a numeric matrix of the same shape as f0
storing the
estimated warping functions;
original_variance
: a numeric value storing the variance of the original
sample;
amplitude_variance
: a numeric value storing the variance in amplitude of
the aligned sample;
phase_variance
: a numeric value storing the variance in phase of the
aligned sample;
qun
: a numeric vector of maximum length max_iter + 2
storing the values
of the cost function after each iteration;
lambda
: the input parameter lambda
which specifies the elasticity;
centroid_type
: the input centroid type;
optim_method
: the input optimization method;
inverse_average_warping_function
: the inverse of the mean estimated
warping function;
rsamps
: TO DO.
A numeric matrix of shape \(M \times N\) specifying a sample of \(N\) curves observed on a grid of size \(M\).
A numeric vector of length \(M\) specifying the common grid on
which all curves f
have been observed.
A numeric value specifying the elasticity. Defaults to 0.0
.
A string specifying the penalty term used in the
formulation of the cost function to minimize for alignment. Choices are
"roughness"
which uses the norm of the second derivative, "geodesic"
which uses the geodesic distance to the identity and "norm"
which uses
the Euclidean distance to the identity. Defaults to "roughness"
.
A string specifying the type of centroid to align to.
Choices are "mean"
or "median"
. Defaults to "mean"
.
A boolean specifying whether to center the estimated
warping functions. Defaults to TRUE
.
A boolean specifying whether to smooth curves using a box
filter. Defaults to FALSE
.
An integer value specifying the number of times to apply the
box filter. Defaults to 25L
. This is used only when smooth_data = TRUE
.
A boolean specifying whether to run calculations in parallel.
Defaults to FALSE
.
number of cores in parallel (default=-1, means all cores)
A string specifying the algorithm used for optimization.
Choices are "DP"
, "DPo"
, and "RBFGS"
. Defaults to "DP"
.
An integer value specifying the maximum number of iterations.
Defaults to 20L
.
Srivastava, A., Wu, W., Kurtek, S., Klassen, E., Marron, J. S., May 2011. Registration of functional data using Fisher-Rao metric, arXiv:1103.3817v2.
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 <- time_warping(simu_data$f, simu_data$time)
}
Run the code above in your browser using DataLab