# What techniques are there available for averaging misaligned multivariate time series? [closed]

I want to get an average time series for a set of multivariate (2-3 coordinates) time series. My aim is finding the usual pattern of several processes.

I researched the literature a bit and I only reached this paper that showed a DTW based approach (DBA) and talked about PSA and NLAAF. I also looked at the links of this question but they are more related to clustering than averaging.

first question: What are the recommended books papers on the topic of time series averaging?

Regarding the implementation, I was able to find a R package that performs the DBA in the dtwclust package but I found nothing on PSA or NLAAF nor other techniques.

second question: What time series averaging software implementations are there available? (preferably open source, I do not care much about the programming language)

Finally, I tried R's DBA implementation in some of my training sets and found an unpleasant result when dealing with repetitive circular trajectories of different lengths and speed (next image).

Last questions: Is there some theoretical consideration I should bare in mind when averaging such time series? What are the recommended preprocessing techniques when dealing with time series?

I know the questions asked are a bit different from each other, but they cover the same topic so I thought they were better together.

Below, I post the code to reproduce the image. The example included in the code consists of 25 time series of different lengths, with a different starting point and a different advancing speed. Think of it as cars racing on a circuit track, the cars are tracked from a random starting point and they are monitored until they finish the race. I calculate the average time series using the DBA function. The problem I find is that the average (plotted in black) does not respect the circular nature of the track and the races performed by the cars (red lines). Note that this is just a particular case, the trajectories I want to track are slightly more complex and, hence, I am more interested in the theory of the field rather than solving this particular example (which I believe can be solved by switching to polar coordinates).

library(dtw)
library(dtwclust)
library(ggplot2)
# Each element of the cars list will be a trajectory
cars<-list()
# 25 time series are included in the list
ncars<-25L

# initialise the seed for reproducibility
set.seed(17)
# each i generates a random time series
for(i in 1:ncars){
# a random starting point is set
ang<-4*pi*(runif(1)-1/2)
# the time series has the coordinates of a process
# that moves in circles. This is just an example,
# the actual processes I'd like to average are slightly
# more complex and move in 3 axes
lap<-data.frame(x=double(),y=double())
# time counter, it indicates the time elapsed from
# the beginning of the observations
t<-1L
# the block simulates spins at a varying random speed
while(ang<8*pi){
# The time series advance randomly
speed<-runif(1)/4
ang<-ang+speed
lap[t,]<-c(cos(ang),sin(ang))
t<-t+1L
}
print(paste0("Duration of observation ",i,": ",t," seconds"))
# store the time series in cars list
cars[[i]]<-lap
}
# average time series with DBA
fit<-DBA(lapply(cars,as.matrix), centroid = NULL, window.size = NULL, norm = "L1",
max.iter = 20L, delta = 0.001, error.check = TRUE, tlap = FALSE)
#  plot the average trajectory of the observations
plot(fit,type="l",col=alpha(1,0.5),asp=1,ylab="y",xlab="x")
# original trajectories of the observations
for(i in cars){lines(i,col=alpha(2,0.05))}