Title: | Wavelet Variance |
---|---|
Description: | Provides a series of tools to compute and plot quantities related to classical and robust wavelet variance for time series and regular lattices. More details can be found, for example, in Serroukh, A., Walden, A.T., & Percival, D.B. (2000) <doi:10.2307/2669537> and Guerrier, S. & Molinari, R. (2016) <arXiv:1607.05858>. |
Authors: | Stéphane Guerrier [aut, cre], James Balamuta [aut], Justin Lee [aut], Roberto Molinari [aut], Yuming Zhang [aut], Mucyo Karemera [aut], Nathanael Claussen [ctb], Haotian Xu [ctb], Lionel Voirol [ctb] |
Maintainer: | Stéphane Guerrier <[email protected]> |
License: | AGPL-3 |
Version: | 0.1.2 |
Built: | 2024-11-23 06:44:35 UTC |
Source: | CRAN |
The ACF function computes the estimated autocovariance or autocorrelation for both univariate and multivariate cases.
ACF(x, lagmax = 0, cor = TRUE, demean = TRUE)
ACF(x, lagmax = 0, cor = TRUE, demean = TRUE)
x |
A |
lagmax |
A |
cor |
A |
demean |
A |
lagmax
default is where
is the number of
observations and
is the number of series being compared. If
lagmax
supplied is greater than the number of observations, then one
less than the total will be taken.
An array
of dimensions .
Yunxiang Zhang
# Get Autocorrelation m = ACF(datasets::AirPassengers) # Get Autocovariance and do not remove trend from signal m = ACF(datasets::AirPassengers, cor = FALSE, demean = FALSE)
# Get Autocorrelation m = ACF(datasets::AirPassengers) # Get Autocovariance and do not remove trend from signal m = ACF(datasets::AirPassengers, cor = FALSE, demean = FALSE)
This data set contains wavelet variance of gyroscope and accelerometer data from an ADIS 16405 sensor.
adis_wv
adis_wv
A list of the following elements:
"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.
"wvar": A list containing the computed wavelet variance based on the data.
The IMU data comes from Department of Geomatics Engineering, University of Calgary.
This function computes the Haar WV of an AR(1) process
ar1_to_wv(phi, sigma2, tau)
ar1_to_wv(phi, sigma2, tau)
phi |
A |
sigma2 |
A |
tau |
A |
This function is significantly faster than its generalized counter part
arma_to_wv
.
A vec
containing the wavelet variance of the AR(1) process.
The Autoregressive Order (AR(
)) process has a Haar Wavelet Variance given by:
This function computes the Haar Wavelet Variance of an ARMA process
arma_to_wv(ar, ma, sigma2, tau)
arma_to_wv(ar, ma, sigma2, tau)
ar |
A |
ma |
A |
sigma2 |
A |
tau |
A |
The function is a generic implementation that requires a stationary theoretical autocorrelation function (ACF)
and the ability to transform an ARMA(,
) process into an MA(
) (e.g. infinite MA process).
A vec
containing the wavelet variance of the ARMA process.
The Autoregressive Order and Moving Average Order
(ARMA(
,
)) process has a Haar Wavelet Variance given by:
where is given by the variance of the ARMA process.
Furthermore, this assumes that stationarity has been achieved as it directly
ARMAtoMA_cpp
, ARMAacf_cpp
, and arma11_to_wv
This function computes the WV (haar) of an Autoregressive Order 1 - Moving Average Order 1 (ARMA(1,1)) process.
arma11_to_wv(phi, theta, sigma2, tau)
arma11_to_wv(phi, theta, sigma2, tau)
phi |
A |
theta |
A |
sigma2 |
A |
tau |
A |
This function is significantly faster than its generalized counter part
arma_to_wv
A vec
containing the wavelet variance of the ARMA(1,1) process.
The Autoregressive Order and Moving Average Order
(ARMA(
,
)) process has a Haar Wavelet Variance given by:
This function allows us to calculate the theoretical allan variance for stationary first-order autoregressive (AR1) process.
av_ar1(n, phi, sigma2)
av_ar1(n, phi, sigma2)
n |
An |
phi |
A |
sigma2 |
A |
A double
indicating the theoretical allan variance for AR1 process.
This function is based on the calculation of the theoretical allan variance for stationary AR1 process raised in "Allan Variance of Time Series Models for Measurement Data" by Nien Fan Zhang.) This calculation is fundamental and necessary for the study in "A Study of the Allan Variance for Constant-Mean Non-Stationary Processes" by Xu et al. (IEEE Signal Processing Letters, 2017).
Yuming Zhang
av1 = av_ar1(n = 5, phi = 0.9, sigma2 = 1) av2 = av_ar1(n = 8, phi = 0.5, sigma2 = 2)
av1 = av_ar1(n = 5, phi = 0.9, sigma2 = 1) av2 = av_ar1(n = 8, phi = 0.5, sigma2 = 2)
This function allows us to calculate the theoretical allan variance for stationary white noise process.
av_wn(sigma2, n)
av_wn(sigma2, n)
sigma2 |
A |
n |
An |
A double
indicating the theoretical allan variance for the white noise
process.
This function is based on the calculation of the theoretical allan variance for stationary white noise process raised in "Allan Variance of Time Series Models for Measurement Data" by Nien Fan Zhang. This calculation is fundamental and necessary for the study in "A Study of the Allan Variance for Constant-Mean Non-Stationary Processes" by Xu et al. (IEEE Signal Processing Letters, 2017).
Yuming Zhang
av1 = av_wn(sigma2 = 1, n = 5) av2 = av_wn(sigma2 = 2, n = 8)
av1 = av_wn(sigma2 = 1, n = 5) av2 = av_wn(sigma2 = 2, n = 8)
Displays plots of multiple wavelet variances of different time series accounting for CI values.
compare_wvar( ..., split = FALSE, add_legend = TRUE, units = NULL, xlab = NULL, ylab = NULL, main = NULL, col_wv = NULL, col_ci = NULL, nb_ticks_x = NULL, nb_ticks_y = NULL, legend_position = NULL, ci_wv = NULL, point_cex = NULL, point_pch = NULL, names = NULL, cex_labels = 0.8, x_range = NULL, y_range = NULL )
compare_wvar( ..., split = FALSE, add_legend = TRUE, units = NULL, xlab = NULL, ylab = NULL, main = NULL, col_wv = NULL, col_ci = NULL, nb_ticks_x = NULL, nb_ticks_y = NULL, legend_position = NULL, ci_wv = NULL, point_cex = NULL, point_pch = NULL, names = NULL, cex_labels = 0.8, x_range = NULL, y_range = NULL )
... |
One or more time series objects. |
split |
A |
add_legend |
A |
units |
A |
xlab |
A |
ylab |
A |
main |
A |
col_wv |
A |
col_ci |
A |
nb_ticks_x |
An |
nb_ticks_y |
An |
legend_position |
A |
ci_wv |
A |
point_cex |
A |
point_pch |
A |
names |
A |
cex_labels |
A |
x_range |
A |
y_range |
A |
Stephane Guerrier and Justin Lee
set.seed(999) n = 10^4 Xt = arima.sim(n = n, list(ar = 0.10)) Yt = arima.sim(n = n, list(ar = 0.35)) Zt = arima.sim(n = n, list(ar = 0.70)) Wt = arima.sim(n = n, list(ar = 0.95)) wv_Xt = wvar(Xt) wv_Yt = wvar(Yt) wv_Zt = wvar(Zt) wv_Wt = wvar(Wt) compare_wvar(wv_Xt, wv_Yt, wv_Zt, wv_Wt)
set.seed(999) n = 10^4 Xt = arima.sim(n = n, list(ar = 0.10)) Yt = arima.sim(n = n, list(ar = 0.35)) Zt = arima.sim(n = n, list(ar = 0.70)) Wt = arima.sim(n = n, list(ar = 0.95)) wv_Xt = wvar(Xt) wv_Yt = wvar(Yt) wv_Zt = wvar(Zt) wv_Wt = wvar(Wt) compare_wvar(wv_Xt, wv_Yt, wv_Zt, wv_Wt)
This is a helper function for the compare_var()
function.
This method accepts the same set of arguments as compare_wvar
and returns a single plot
that compares multiple wavelet variances of different time series accounting for CI values.
compare_wvar_no_split(graph_details)
compare_wvar_no_split(graph_details)
graph_details |
List of inputs |
Stephane Guerrier, Justin Lee, and Nathanael Claussen
This is a helper function for the compare_var()
function.
This method accepts the same set of arguments as compare_wvar
and returns a comparision
of multiple wavelet variances of different time series accounting for CI values as a set of different plots.
compare_wvar_split(graph_details)
compare_wvar_split(graph_details)
graph_details |
List of inputs |
Stephane Guerrier, Justin Lee, and Nathanael Claussen
This function compute the WV (haar) of a Drift process
dr_to_wv(omega, tau)
dr_to_wv(omega, tau)
omega |
A |
tau |
A |
A vec
containing the wavelet variance of the drift.
The Drift (DR) process has a Haar Wavelet Variance given by:
Calculation of the coefficients for the discrete wavelet transformation
dwt(x, nlevels = floor(log2(length(x))), filter = "haar")
dwt(x, nlevels = floor(log2(length(x))), filter = "haar")
x |
A |
nlevels |
A |
filter |
A |
Performs a level decomposition of the time series using the pyramid algorithm.
The default
is determined by
A field<vec>
that contains the wavelet coefficients for each decomposition level
James Balamuta, Justin Lee and Stephane Guerrier
set.seed(999) x = rnorm(2^8) ret = dwt(x) summary(ret) plot(ret)
set.seed(999) x = rnorm(2^8) ret = dwt(x) summary(ret) plot(ret)
This data set contains wavelet variance of IMAR gyroscopes data.
imar_wv
imar_wv
A list of the following elements:
"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.
"wvar": A list containing the computed wavelet variance based on the data.
The IMU data comes from Geodetic Engineering Laboratory (TOPO) and Swiss Federal Institute of Technology Lausanne (EPFL).
This data set contains wavelet variance of gyroscope and accelerometer data from an KVH1750 sensor.
kvh1750_wv
kvh1750_wv
A list of the following elements:
"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.
"wvar": A list containing the computed wavelet variance based on the data.
The IMU data comes from Department of Geomatics Engineering, University of Calgary.
This data set contains wavelet variance of LN200 gyroscope and accelerometer data.
ln200_wv
ln200_wv
A list of the following elements:
"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.
"wvar": A list containing the computed wavelet variance based on the data.
The IMU data comes from Geodetic Engineering Laboratory (TOPO) and Swiss Federal Institute of Technology Lausanne (EPFL).
This function computes the WV (haar) of a Moving Average order 1 (MA1) process.
ma1_to_wv(theta, sigma2, tau)
ma1_to_wv(theta, sigma2, tau)
theta |
A |
sigma2 |
A |
tau |
A |
This function is significantly faster than its generalized counter part
arma_to_wv
.
A vec
containing the wavelet variance of the MA(1) process.
The Moving Average Order (MA(
)) process has a Haar Wavelet Variance given by:
Calculates the coefficients for the discrete wavelet transformation
modwt(x, nlevels = floor(log2(length(x) - 1)), filter = "haar")
modwt(x, nlevels = floor(log2(length(x) - 1)), filter = "haar")
x |
A |
nlevels |
A |
filter |
A |
Performs a level decomposition of the time series using the pyramid algorithm.
The default
is determined by
A field<vec>
that contains the wavelet coefficients for each decomposition level
James Balamuta, Justin Lee and Stephane Guerrier
set.seed(999) x = rnorm(100) ret = modwt(x) summary(ret) plot(ret)
set.seed(999) x = rnorm(100) ret = modwt(x) summary(ret) plot(ret)
This function compute the Haar WV of a Quantisation Noise (QN) process
qn_to_wv(q2, tau)
qn_to_wv(q2, tau)
q2 |
A |
tau |
A |
A vec
containing the wavelet variance of the QN.
The Quantization Noise (QN) process has a Haar Wavelet Variance given by:
Displays a plot of the wavelet variances (classical and robust) for a given time series accounting for CI values.
robust_eda( x, eff = 0.6, units = NULL, xlab = NULL, ylab = NULL, main = NULL, col_wv = NULL, col_ci = NULL, nb_ticks_x = NULL, nb_ticks_y = NULL, legend_position = NULL, ... )
robust_eda( x, eff = 0.6, units = NULL, xlab = NULL, ylab = NULL, main = NULL, col_wv = NULL, col_ci = NULL, nb_ticks_x = NULL, nb_ticks_y = NULL, legend_position = NULL, ... )
x |
A time series objects. |
eff |
An |
units |
A |
xlab |
A |
ylab |
A |
main |
A |
col_wv |
A |
col_ci |
A |
nb_ticks_x |
An |
nb_ticks_y |
An |
legend_position |
A |
... |
Additional arguments affecting the plot. |
Plot of wavelet variance and confidence interval for each scale.
Stephane Guerrier, Nathanael Claussen, and Justin Lee
set.seed(999) n = 10^4 Xt = rnorm(n) wv = wvar(Xt) plot(wv) plot(wv, main = "Simulated white noise", xlab = "Scales") plot(wv, units = "sec", legend_position = "topright") plot(wv, col_wv = "darkred", col_ci = "pink")
set.seed(999) n = 10^4 Xt = rnorm(n) wv = wvar(Xt) plot(wv) plot(wv, main = "Simulated white noise", xlab = "Scales") plot(wv, units = "sec", legend_position = "topright") plot(wv, col_wv = "darkred", col_ci = "pink")
This function compute the WV (haar) of a Random Walk process
rw_to_wv(gamma2, tau)
rw_to_wv(gamma2, tau)
gamma2 |
A |
tau |
A |
A vec
containing the wavelet variance of the random walk.
The Random Walk (RW) process has a Haar Wavelet Variance given by:
Computes the total phi and total theta vector length.
sarma_objdesc(ar, ma, sar, sma, s, i, si)
sarma_objdesc(ar, ma, sar, sma, s, i, si)
ar |
A |
ma |
A |
sar |
A |
sma |
A |
s |
An |
i |
An |
si |
An |
A vec
with rows:
Number of Non-Seasonal AR Terms
Number of Non-Seasonal MA Terms
Number of Seasonal AR Terms
Number of Seasonal MA Terms
Number of Variances (always 1)
Season Value
Number of non-seasonal differences
Number of Seasonal Differences
Haar filter for a spatial case
sp_hfilter(jscale)
sp_hfilter(jscale)
jscale |
An |
Compute the Spatial Wavelet Coefficients
sp_modwt_cpp(X, J1, J2)
sp_modwt_cpp(X, J1, J2)
X |
is a matrix with row, col orientation |
J1 , J2
|
is the levels of decomposition along the rows, columns |
By default this function will return the wavelet coefficient in addition to the wavelet
A list
of vectors
containing the wavelet coefficients.
Calculates the Cross-covariance between multiple wavelet transfomations (dwt or modwt)
wccv(x, decomp = "modwt", filter = "haar", nlevels = NULL)
wccv(x, decomp = "modwt", filter = "haar", nlevels = NULL)
x |
A |
decomp |
A |
filter |
A |
nlevels |
An |
If nlevels
is not specified, it is set to
Returns a matrix
of lists
of all the possible pair cross-covariance, variance of each wavelet cross-covariance and its 95
Justin Lee
Map x to the value in log10 scale
wccv_get_y(x, tick_y_min, tick_y_step)
wccv_get_y(x, tick_y_min, tick_y_step)
x |
A |
tick_y_min |
A |
tick_y_step |
An |
tick_y_min
is usually chosen as
A field<vec>
that contains values in log10 scale.
James Balamuta and Justin Lee
x = 2^(-1:-9) y.min = floor(min(log10(abs(x)))) y.step = 2 wccv_get_y(x, y.min, y.step)
x = 2^(-1:-9) y.min = floor(min(log10(abs(x)))) y.step = 2 wccv_get_y(x, y.min, y.step)
Calculates the Cross-covariance between two wavelet transfomations (dwt or modwt)
wccv_pair(x, y, decomp = "modwt", filter = "haar", nlevels = NULL)
wccv_pair(x, y, decomp = "modwt", filter = "haar", nlevels = NULL)
x |
A |
y |
A |
decomp |
A |
filter |
A |
nlevels |
An |
If nlevels
is not specified, it is set to
Returns a list
of a matrix
containing cross-covariance, variance of each wavelet cross-covariance and its 95
Justin Lee
This function compute the Haar WV of a Gaussian White Noise process
wn_to_wv(sigma2, tau)
wn_to_wv(sigma2, tau)
sigma2 |
A |
tau |
A |
A vec
containing the wavelet variance of the white noise.
The Gaussian White Noise (WN) process has a Haar Wavelet Variance given by:
Calculates the (MO)DWT wavelet variance
wvar(x, ...) ## S3 method for class 'lts' wvar( x, decomp = "modwt", filter = "haar", nlevels = NULL, alpha = 0.05, robust = FALSE, eff = 0.6, to.unit = NULL, ... ) ## S3 method for class 'gts' wvar( x, decomp = "modwt", filter = "haar", nlevels = NULL, alpha = 0.05, robust = FALSE, eff = 0.6, to.unit = NULL, ... ) ## S3 method for class 'ts' wvar( x, decomp = "modwt", filter = "haar", nlevels = NULL, alpha = 0.05, robust = FALSE, eff = 0.6, to.unit = NULL, ... ) ## S3 method for class 'imu' wvar( x, decomp = "modwt", filter = "haar", nlevels = NULL, alpha = 0.05, robust = FALSE, eff = 0.6, to.unit = NULL, ... ) ## Default S3 method: wvar( x, decomp = "modwt", filter = "haar", nlevels = NULL, alpha = 0.05, robust = FALSE, eff = 0.6, freq = 1, from.unit = NULL, to.unit = NULL, ... )
wvar(x, ...) ## S3 method for class 'lts' wvar( x, decomp = "modwt", filter = "haar", nlevels = NULL, alpha = 0.05, robust = FALSE, eff = 0.6, to.unit = NULL, ... ) ## S3 method for class 'gts' wvar( x, decomp = "modwt", filter = "haar", nlevels = NULL, alpha = 0.05, robust = FALSE, eff = 0.6, to.unit = NULL, ... ) ## S3 method for class 'ts' wvar( x, decomp = "modwt", filter = "haar", nlevels = NULL, alpha = 0.05, robust = FALSE, eff = 0.6, to.unit = NULL, ... ) ## S3 method for class 'imu' wvar( x, decomp = "modwt", filter = "haar", nlevels = NULL, alpha = 0.05, robust = FALSE, eff = 0.6, to.unit = NULL, ... ) ## Default S3 method: wvar( x, decomp = "modwt", filter = "haar", nlevels = NULL, alpha = 0.05, robust = FALSE, eff = 0.6, freq = 1, from.unit = NULL, to.unit = NULL, ... )
x |
A |
... |
Further arguments passed to or from other methods. |
decomp |
A |
filter |
A |
nlevels |
An |
alpha |
A |
robust |
A |
eff |
A |
to.unit |
A |
freq |
A |
from.unit |
A |
The default value of nlevels
will be set to , unless otherwise specified.
A list
with the structure:
"variance": Wavelet Variance
"ci_low": Lower CI
"ci_high": Upper CI
"robust": Robust active
"eff": Efficiency level for Robust calculation
"alpha": p value used for CI
"unit": String representation of the unit
James Balamuta, Justin Lee and Stephane Guerrier
set.seed(999) x = rnorm(100) # Default wvar(x) # Robust wvar(x, robust = TRUE, eff=0.3) # Classical wvar(x, robust = FALSE, eff=0.3) # 90% Confidence Interval wvar(x, alpha = 0.10)
set.seed(999) x = rnorm(100) # Default wvar(x) # Robust wvar(x, robust = TRUE, eff=0.3) # Classical wvar(x, robust = FALSE, eff=0.3) # 90% Confidence Interval wvar(x, alpha = 0.10)