# [time-nuts] σ vs s in ADEV

Magnus Danielson magnus at rubidium.dyndns.org
Thu Jan 5 06:33:16 EST 2017

```Hi,

On 01/05/2017 01:26 AM, Tom Van Baak wrote:
> Hi Attila,
>
> The plain ADEV calculation is essentially a measure of unexpected or
> unwanted drift in frequency; which is the 1st difference of frequency
> error; the 2nd difference of phase error; the 3rd difference in clock
> time itself.

ADEV is thus sensitive to linear drift, which becomes a limiting factor
for higher tau.

I can't see how clock time itself would integrate from phase. The time
of a clock is just an enumeration of phase. Phase is often presented in
a wrapped phase, but if you enumerate it is still just phase with larger
numbers, ADEV is still just 2nd difference away, not 3rd. It's actually
the time of x being used, not phase.

> When measuring the quality of a clock, the key idea is that initial
> phase doesn't matter (you can always manually set the time), and even
> initial frequency doesn't matter (you can often adjust the rate:
> whether pendulum, quartz or atomic clock), and so a more honest
> measure of intrinsic timekeeper stability is its ability to maintain
> frequency; that is, statistically speaking, the lower the change in
> frequency, tau to tau, the better. Change in frequency is frequency
> drift.

Due to the second difference, phase offset and frequency offset does not
affect the ADEV. Similarly for frequency measurement which is the first
difference, phase offset does not affect the frequency estimation.

> If you have N phase samples, you get N-1 frequency samples and N-2
> drift samples. The standard ADEV calculation is simply based on the
> mean of those drift samples. (and you know Hadamard takes this one
> step deeper).
>
> If you look a the code at http://leapsecond.com/tools/adev_lib.c
> you'll see I avoid the confusing issue of N-1, N, N+1 and simply
> count the number of terms in the rms sum. Not only does that give the
> correct result but IMHO it make it clear what is being averaged. The
> code passes the official NBS ADEV sample suite, agrees with Bill's
> Stable32, is used in John's TimeLab, and also Mark's Lady Heather.

The NIST 1000-point test-suite in NIST SP 1065 is recommended these days
as a test sequence. That's what I used to test all my implementations.

> I've never quite understood the pedantic separation of "sample" and
> "population" mean that statistic textbooks and academics love to
> discuss. They clearly have never measured oscillators. In my
> experience if you think there's an important difference between N and
> N-1, then that's nature's way of telling you to go back to sleep and
> wait until tomorrow when you have more data. If your N is too small
> your ADEV wanders all over the place (TimeLab is good at displaying
> this in real-time) -- meaning that the distinction between sample
> (n-1) and population (n) mean is beyond ridiculous; even if there's a

Traditional statistical textbooks only measure with white noise
disturbance for starters. What we do in ADEV and friends space is much
more complex. Traditional textbooks can get us up to speed with some of
the basics, but as we get flicker involved we are doomed. The
integration of the oscillator loop then give support for four noise
forms which is quite different.

So, the (n-1) and (n) issue is relevant when n is small and you have
the full degree of freedom and estimating it is trivial, it's (n-1)
which is why this is the average to use for standard deviation/variance.
That you can loose degrees of freedom due to how the noise interact with
the estimator is well beyond the textbooks. As you study these tools
more deeply, you essentially study advanced statistical methods.

After studying that I've become more particular about saying things like
estimator, bias functions, degrees of freedom and confidence intervals.

As the noiseforms work against us, we have to work hard to get high
degree of freedom for part of a measure, so that the confidence
intervals goes down. As we do that we either measure longer or use
another estimator with better performance. Some of these measures
introduce biases, but those can be worked out and compensated for, often
without too much effort.

Terms like deviation, variance, degrees of freedom, confidence interval
and estimator can be best learned in traditional statistics first. Then
you need to do the follow-up coarse for non-white noise statistics.

Cheers,
Magnus
```