How can I calculate the Allan Variance of a list of Data?

I have a list with over 10.000 elements of data. Now I wanna calculate the Allan Variance of this Measurement. The Allan Variance is defined as following:

$$\sigma_y^2(\tau)=\frac1{2\tau^2}\langle(x_{n+2}-2x_{n+1}+x_n)^2\rangle$$

How do I do it?

Data Sample:

sample={4.59654*10^9, 4.59655*10^9, 4.59655*10^9, 4.59656*10^9, 4.59655*10^9,4.59655*10^9, 4.59658*10^9, 4.59656*10^9, 4.59657*10^9, 4.59654*10^9, 4.59656*10^9, 4.59657*10^9, 4.59655*10^9, 4.59656*10^9, 4.59656*10^9, 4.59655*10^9, 4.59656*10^9, 4.59654*10^9, 4.59656*10^9, 4.59656*10^9, 4.59655*10^9, 4.59657*10^9, 4.59655*10^9, 4.59655*10^9, 4.59654*10^9, 4.59656*10^9, 4.59656*10^9}


The whole measurement was made every 0.3s over a period of 1 hour.

• You might be interested in Differences[]. Jan 22, 2021 at 15:45
• Give us a sample of your data as well. Which of the estimators listed on the Wiki page is most appropriate in your application? Jan 22, 2021 at 15:47
• I would say fixed tau estimator. Jan 22, 2021 at 16:22
• A user-defined variable should start with a lower-case letter to avoid potential naming conflicts with built-in names. For example, List has a specific use in Mathematica. Jan 22, 2021 at 16:35
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Jan 22, 2021 at 17:15

I think this does what you need:

AVAR[list_List, tau_] /; Length[list] > 2 := Divide[
Mean[
Subtract[Drop[list, -2] + Drop[list, 2], 2*Take[list, {2, -2}]]^2
],
2 * tau^2
];
AVAR[sample, 1]


3.78*10^8

Symbolic example:

AVAR[Array[x, 5], \[Tau]]


Edit

J.M.'s approach based on Differences (I honestly didn't know it had this functionality, but it's obvious in hindsight):

AVAR[list_List, tau_] /; Length[list] > 2 := Divide[
Mean[Differences[list, 2]^2],
2*tau^2
];

• As I mentioned in the comments, Differences[] works nicely here: AVAR[list_List, tau_] /; Length[list] > 2 := Divide[Mean[Differences[list, 2]^2], 2 tau^2] Jan 22, 2021 at 16:57