Learn R Programming

fdasrvf (version 2.4.2)

ppd: Compute Peak Persistence Diagram

Description

This computes the peak persistence diagram over a range of lambda. This can help determine the proper elasticity (penalty). This can be slow and recommended to run in parallel

Usage

ppd(
  f,
  time,
  max_lam = 2,
  num_lam = 10,
  pt = 0.15,
  penalty_method = c("roughness", "geodesic", "norm"),
  centroid_type = c("mean", "median"),
  center_warpings = TRUE,
  smooth_data = FALSE,
  sparam = 25L,
  parallel = TRUE,
  cores = -1,
  optim_method = c("DP", "DPo", "DP2", "RBFGS"),
  max_iter = 20L
)

Value

lam_opt optimal lam

Arguments

f

A numeric matrix of shape \(M \times N\) specifying a sample of \(N\) curves observed on a grid of size \(M\).

time

A numeric vector of length \(M\) specifying the common grid on which all curves f have been observed.

max_lam

maximum value of lambda. Defaults to 2

num_lam

number of steps. Defaults to 10

pt

the percentile of negative curvature of raw data Defaults to .15

penalty_method

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".

centroid_type

A string specifying the type of centroid to align to. Choices are "mean" or "median". Defaults to "mean".

center_warpings

A boolean specifying whether to center the estimated warping functions. Defaults to TRUE.

smooth_data

A boolean specifying whether to smooth curves using a box filter. Defaults to FALSE.

sparam

An integer value specifying the number of times to apply the box filter. Defaults to 25L. This is used only when smooth_data = TRUE.

parallel

A boolean specifying whether to run calculations in parallel. Defaults to TRUE.

cores

number of cores in parallel (default=-1, means all cores)

optim_method

A string specifying the algorithm used for optimization. Choices are "DP", "DPo", and "RBFGS". Defaults to "DP".

max_iter

An integer value specifying the maximum number of iterations. Defaults to 20L.

References

Kim, Woo Min, Sutanoy Dasgupta, and Anuj Srivastava. "Peak-persistence diagrams for estimating shapes and functions from noisy data." arXiv preprint arXiv:2305.04826 (2023).

Examples

Run this code
if (FALSE) {
  out <- ppd(simu_data$f, simu_data$time)
}

Run the code above in your browser using DataLab