OEBFDTW: Open-end/open-begin Functional Dynamic Time Warping...

View source: R/FRTM.R

OEBFDTWR Documentation

Open-end/open-begin Functional Dynamic Time Warping (OEB-FDTW)

Description

This function implements the OEB-FDTW.

Usage

OEBFDTW(
  x_fd,
  template_fd,
  der_x_fd,
  der_template_fd,
  alpha_vec = c(0, 0.5, 1),
  fit_c = FALSE,
  N = 100,
  M = 50,
  smin = 0.01,
  smax = 1000,
  lambda = 10^-5,
  eta = 0.5,
  iter = 3,
  delta_xs = 0,
  delta_xe = 0,
  delta_ys = 0,
  delta_ye = 0,
  der_0 = NULL,
  seq_t = NULL,
  get_fd = "no",
  n_basis_x = NULL
)

Arguments

x_fd

An object of class fd corresponding to the misaligned function.

template_fd

An object of class fd corresponding to the template function.

der_x_fd

An object of class fd corresponding to the first derivative of x_fd.

der_template_fd

An object of class fd corresponding to the first derivative of template_fd.

alpha_vec

Grid of values to find the optimal value of \alpha_i.

fit_c

If TRUE, the value of the objective function without the penalization evaluated at the solution is returned.

N

The number N_{t} of evenly spaced values along the template domain \mathcal{D}_{Y}.

M

The number M_{x} of evenly spaced values along the functional observation domain \mathcal{D}_{X_i}.

smin

The minimum values allowed for the first derivative of the warping function h_i. If NULL, in FRTM_PhaseI, it is set as 0.001 multiplied by the ratio between the size of the monitoring and template domains.

smax

The maximum values allowed for the first derivative of the warping function h_i. If NULL, in FRTM_PhaseI, it is set as 100 multiplied by the ratio between the size of the monitoring and template domains.

lambda

The smoothing parameter \lambda_i.

eta

Fraction \eta for updating the constraint bounds to reduce the error associated to the discretization (Deriso and Boyd, 2022).

iter

Number of iteration in the iterative refinement to reduce the error associated to the discretization (Deriso and Boyd, 2022).

delta_xs

Maximum allowed misalignment at the beginning of the process along the misaligned function domain.

delta_xe

Maximum allowed misalignment at the end of the process along the misaligned function domain.

delta_ys

Maximum allowed misalignment at the beginning of the process along the template domain.

delta_ye

Maximum allowed misalignment at the end of the process along the template domain.

der_0

The target values towards which shrinking the warping function slope. If NULL, it is equal to the ratio between the size of the domain of x_fd and the size of the domain of template_fd.

seq_t

Discretized sequence in the template domain \mathcal{D}_{Y}. If NULL, an equally spaced grid of length N in the template domain is used.

get_fd

If "x_reg", the registered function as a class fd object is returned. If "no", the registered function as a class fd object is not returned.

n_basis_x

Number of basis to obtain the registered function. If NULL, it is set as 0.5 the length of the optimal path.

Value

A list containing the following arguments:

mod that is a list composed by

  • h_fd: The estimated warping function.

  • x_reg: The registered function.

  • h_list: A list containing the discretized warping function for each iteration of the iterative refinement.

  • min_cost: Optimal value of the objective function.

  • lambda: The smoothing parameter \lambda.

  • alpha: Optimal value of the parameter \alpha_i.

obj Values of the objective function for each value in alpha_vec.

fit Values of the objective function without the penalization for each value in alpha_vec.

obj_opt Optimal value of the objective function.

fit_opt Optimal value of the objective function without the penalization.

Author(s)

F. Centofanti

References

Centofanti, F., A. Lepore, M. Kulahci, and M. P. Spooner (2024). Real-time monitoring of functional data. Accepted for publication in Journal of Quality Technology.

Deriso, D. and S. Boyd (2022). A general optimization framework for dynamic time warping. Optimization and Engineering, 1-22.

Examples


set.seed(1)
data <- simulate_data_FRTM(n_obs = 100)

dom <- c(0, 1)
basis_x <- fda::create.bspline.basis(c(0, 1), nbasis = 30)
x_fd <-
  fda::smooth.basis(data$grid_i[[1]] / max(data$grid_i[[1]]), data$x_err[[1]], basis_x)$fd
template_fd <-
  fda::smooth.basis(data$grid_template, data$template, basis_x)$fd
der_x_fd <- fda::deriv.fd(x_fd, 1)
der_template_fd <- fda::deriv.fd(template_fd, 1)

mod <-
  OEBFDTW(x_fd, template_fd, der_x_fd , der_template_fd, get_fd = "x_reg")

funcharts documentation built on April 3, 2025, 7:47 p.m.