Circularly rotate each curve so that its global maximum is at a canonical grid position. This is useful as a pre-processing step before elastic alignment of periodic functional data (e.g., data on \([0, 2\pi]\) where \(f(0) = f(2\pi)\)).
Value
A list with components:
- fdataobj
fdata of rotated curves
- shifts
integer vector of circular shifts applied to each curve
Examples
# Periodic sinusoidal curves with random circular shifts
argvals <- seq(0, 2 * pi, length.out = 100)
data <- matrix(0, 10, 100)
for (i in 1:10) {
shift <- sample(0:99, 1)
idx <- ((seq_len(100) - 1 + shift) %% 100) + 1
data[i, ] <- sin(argvals[idx])
}
fd <- fdata(data, argvals = argvals)
rot <- periodic.rotate(fd)