This function estimates the Allan variance.
avar(x, type = "mo", ...)# S3 method for default
avar(x, type = "mo", freq = 1, ...)
# S3 method for imu
avar(x, type = "mo", ...)
If the input x
is a vec
, then the function returns a list
that contains:
"levels": The averaging time at each level.
"allan": The estimated Allan variance.
"type": Type of estimator (mo
or to
).
If the input x
is an imu
object, then the function returns a list
that contains:
"sensor": Name of the sensor.
"freq": The frequency at which the error signal is measured.
"n": Sample size of the data.
"type": The types of sensors considered in the data.
"axis": The axes of sensors considered in the data.
"avar": A list containing the computed Allan variance based on the data.
A vec
of time series observations or an imu
object.
A string
containing either "mo"
for Maximal Overlap or "to"
for Tau Overlap.
Further arguments passed to other methods.
Given \(N\) equally spaced samples with averaging time \(\tau = n\tau _0\), we define \(n\) as an integer such that \( 1 \le n \le \frac{N}{2}\). Therefore, \(n\) can be selected from \(\left\{ {n|n < \left\lfloor {{{\log }_2}\left( N \right)} \right\rfloor } \right\}\) Based on the latter, we have \(M = N - 2n\) levels of decomposition. The Maximal-overlap estimator is given by: $$\frac{1}{{2\left( {N - 2k + 1} \right)}}\sum\limits_{t = 2k}^N {{{\left[ {{{\bar Y}_t}\left( k \right) - {{\bar Y}_{t - k}}\left( k \right)} \right]}^2}} $$
where $$ {{\bar y}_t}\left( \tau \right) = \frac{1}{\tau }\sum\limits_{i = 0}^{\tau - 1} {{{\bar y}_{t - i}}} $$.
Given \(N\) equally spaced samples with averaging time \(\tau = n\tau _0\), we define \(n\) as an integer such that \( 1 \le n \le \frac{N}{2}\). Therefore, \(n\) can be selected from \(\left\{ {n|n < \left\lfloor {{{\log }_2}\left( N \right)} \right\rfloor } \right\}\) Based on the latter, we have \(m = \left\lfloor {\frac{{N - 1}}{n}} \right\rfloor - 1\) levels of decomposition. The tau-overlap estimator is given by:
where \( {{\bar y}_t}\left( \tau \right) = \frac{1}{\tau }\sum\limits_{i = 0}^{\tau - 1} {{{\bar y}_{t - i}}} \).
The decomposition and the amount of time it takes to perform this function depends on whether you are using the Maximal Overlap or the Tau Overlap.
Long-Memory Processes, the Allan Variance and Wavelets, D. B. Percival and P. Guttorp
set.seed(999)
Xt = rnorm(10000)
av_mat_mo = avar(Xt, type = "mo", freq = 100)
av_mat_tau = avar(Xt, type = "to")
Run the code above in your browser using DataLab