Single variable changing over time - compare trajectories I am running an experiment in the lab where a variable is measured over time (e.g: 60 seconds)
I run several times the experiment without any disturbance.
Then I run the experiment again by introducing a disturbance in the starting conditions. The trajectory of the variable I am measuring will start in a similar way and then will behave slightly different.
My goal is to be able to identify that a disturbance was made just by looking at the trajectory.
What's the best method to make this comparison? I want to be able to say "this experiment is significantly different from the non disturbed one, so something must be wrong".
I was thinking of using some mvda techniques, such as PCA, and just use each time point as a variable, and then I can see clusters of observations. Is this a good approach?
 A: You need a distance measure between trajectories. It depends on the nature of your process. You could try Mahalanobis on either levels or differences depending on whether your trajectories are stationary or not.
Here's an example. Suppose, your trajectories are not stationary, then first you get the differences:
$$\Delta x_t=x_t-x_{t-1}$$
Next, calculate the covariance matrix using the observations of undisturbed trajectories:
$$C_{ts}=cov[\Delta x_t,\Delta x_s]$$
Note, that you have fewer observations that the length of $\Delta x_t$ vector, therefore, your covariance matrix has a lot of noise. So, you need to regularize it, e.g. using Ledoit-Wolf method.
Once you got regularize covariance matrix $\tilde C_{ts}$, you can plug it into Mahalanobis distance formula:
$$d(\Delta\bar x,\Delta z)= \Delta\bar x\tilde C^{-1}\Delta z'$$
Which gives you a distance between the mean trajectory $\Delta\bar x$ and the given trajectory $\Delta z$. You can train your model to find the threshold distances.
If you want to decide whether the trajectory is disturbed before observing the whole trajectory, then you train your model on the part of a trajectory.
