Type: Package
Title: Wavelet Variance
Version: 0.1.2
Date: 2023-08-29
LazyData: true
Maintainer: Stéphane Guerrier <stef.guerrier@gmail.com>
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) <doi:10.48550/arXiv.1607.05858>.
Depends: R (≥ 3.5.0)
License: AGPL-3
Imports: Rcpp, simts, utils, grDevices, coda, methods, graphics, stats
LinkingTo: Rcpp, RcppArmadillo
RoxygenNote: 7.2.3
Encoding: UTF-8
Suggests: knitr, rmarkdown
URL: https://github.com/SMAC-Group/wv
BugReports: https://github.com/SMAC-Group/wv/issues
NeedsCompilation: yes
Packaged: 2023-08-30 08:10:40 UTC; lionel
Author: 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]
Repository: CRAN
Date/Publication: 2023-08-31 04:40:02 UTC

wv

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>.

Author(s)

Maintainer: Stéphane Guerrier stef.guerrier@gmail.com

Authors:

Other contributors:

See Also

Useful links:


Auto-Covariance and Correlation Functions

Description

The acf function computes the estimated autocovariance or autocorrelation for both univariate and multivariate cases.

Usage

.acf(x, lagmax = 0L, cor = TRUE, demean = TRUE)

Arguments

x

A matrix with dimensions N \times S or N observations and S processes

lagmax

A integer

cor

A bool indicating whether the correlation (TRUE) or covariance (FALSE) should be computed.

demean

A bool indicating whether the data should be detrended (TRUE) or not (FALSE)


Auto-Covariance and Correlation Functions

Description

The ACF function computes the estimated autocovariance or autocorrelation for both univariate and multivariate cases.

Usage

ACF(x, lagmax = 0, cor = TRUE, demean = TRUE)

Arguments

x

A matrix with dimensions N \times S or N observations and S processes

lagmax

A integer indicating the max lag.

cor

A bool indicating whether the correlation (TRUE) or covariance (FALSE) should be computed.

demean

A bool indicating whether the data should be detrended (TRUE) or not (FALSE)

Details

lagmax default is 10*log10(N/m) where N is the number of observations and m 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.

Value

An array of dimensions N \times S \times S.

Author(s)

Yunxiang Zhang

Examples

# Get Autocorrelation
m = ACF(datasets::AirPassengers)

# Get Autocovariance and do not remove trend from signal
m = ACF(datasets::AirPassengers, cor = FALSE, demean = FALSE)

Compute Theoretical ACF for an ARMA Process

Description

Compute the theoretical autocorrelation function for an ARMA process.

Usage

ARMAacf_cpp(ar,ma,lag_max)

Arguments

ar

A vector of length p containing AR coefficients

ma

A vector of length q containing MA coefficients

lag_max

A unsigned integer indicating the maximum lag necessary

Details

This is an implementaiton of the ARMAacf function in R. It is approximately 40x times faster. The benchmark was done on iMac Late 2013 using vecLib as the BLAS.

Value

x A matrix listing values from 1...nx in one column and 1...1, 2...2,....,n...n, in the other

Author(s)

James J Balamuta


Converting an ARMA Process to an Infinite MA Process

Description

Takes an ARMA function and converts it to an infinite MA process.

Usage

ARMAtoMA_cpp(ar, ma, lag_max)

Arguments

ar

A column vector of length p

ma

A column vector of length q

lag_max

A int of the largest MA(Inf) coefficient required.

Details

This function is a port of the base stats package's ARMAtoMA. There is no significant speed difference between the two.

Value

A column vector containing coefficients

Author(s)

James J Balamuta


Helper Function for ARMA to WV Approximation

Description

Indicates where the minimum ARMAacf value is and returns that as an index.

Usage

acf_sum(ar, ma, last_tau, alpha = 0.99)

Arguments

ar

A vec containing the coefficients of the AR process

ma

A vec containing the coefficients of the MA process

last_tau

An int the Jth scale of 2^(1:J)

alpha

A double indicating the cutoff.

Value

A vec containing the wavelet variance of the ARMA process.

See Also

arma_to_wv_app


Wavelet variance of IMU Data from an ADIS 16405 sensor

Description

This data set contains wavelet variance of gyroscope and accelerometer data from an ADIS 16405 sensor.

Usage

adis_wv

Format

A list of the following elements:

Source

The IMU data comes from Department of Geomatics Engineering, University of Calgary.


AR(1) process to WV

Description

This function computes the Haar WV of an AR(1) process

Usage

ar1_to_wv(phi, sigma2, tau)

Arguments

phi

A double that is the phi term of the AR(1) process

sigma2

A double corresponding to variance of AR(1) process

tau

A vec containing the scales e.g. 2^{\tau}

Details

This function is significantly faster than its generalized counter part arma_to_wv.

Value

A vec containing the wavelet variance of the AR(1) process.

Process Haar Wavelet Variance Formula

The Autoregressive Order 1 (AR(1)) process has a Haar Wavelet Variance given by:

\frac{{2{\sigma ^2}\left( {4{\phi ^{\frac{{{\tau _j}}}{2} + 1}} - {\phi ^{{\tau _j} + 1}} - \frac{1}{2}{\phi ^2}{\tau _j} + \frac{{{\tau _j}}}{2} - 3\phi } \right)}}{{{{\left( {1 - \phi } \right)}^2}\left( {1 - {\phi ^2}} \right)\tau _j^2}}

See Also

arma_to_wv, arma11_to_wv


ARMA(1,1) to WV

Description

This function computes the WV (haar) of an Autoregressive Order 1 - Moving Average Order 1 (ARMA(1,1)) process.

Usage

arma11_to_wv(phi, theta, sigma2, tau)

Arguments

phi

A double corresponding to the autoregressive term.

theta

A double corresponding to the moving average term.

sigma2

A double the variance of the process.

tau

A vec containing the scales e.g. 2^{\tau}

Details

This function is significantly faster than its generalized counter part arma_to_wv

Value

A vec containing the wavelet variance of the ARMA(1,1) process.

Process Haar Wavelet Variance Formula

The Autoregressive Order 1 and Moving Average Order 1 (ARMA(1,1)) process has a Haar Wavelet Variance given by:

\nu _j^2\left( {\phi ,\theta ,{\sigma ^2}} \right) = - \frac{{2{\sigma ^2}\left( { - \frac{1}{2}{{(\theta + 1)}^2}\left( {{\phi ^2} - 1} \right){\tau _j} - (\theta + \phi )(\theta \phi + 1)\left( {{\phi ^{{\tau _j}}} - 4{\phi ^{\frac{{{\tau _j}}}{2}}} + 3} \right)} \right)}}{{{{(\phi - 1)}^3}(\phi + 1)\tau _j^2}}

See Also

arma_to_wv


ARMA process to WV

Description

This function computes the Haar Wavelet Variance of an ARMA process

Usage

arma_to_wv(ar, ma, sigma2, tau)

Arguments

ar

A vec containing the coefficients of the AR process

ma

A vec containing the coefficients of the MA process

sigma2

A double containing the residual variance

tau

A vec containing the scales e.g. 2^{\tau}

Details

The function is a generic implementation that requires a stationary theoretical autocorrelation function (ACF) and the ability to transform an ARMA(p,q) process into an MA(\infty) (e.g. infinite MA process).

Value

A vec containing the wavelet variance of the ARMA process.

Process Haar Wavelet Variance Formula

The Autoregressive Order p and Moving Average Order q (ARMA(p,q)) process has a Haar Wavelet Variance given by:

\frac{{{\tau _j}\left[ {1 - \rho \left( {\frac{{{\tau _j}}}{2}} \right)} \right] + 2\sum\limits_{i = 1}^{\frac{{{\tau _j}}}{2} - 1} {i\left[ {2\rho \left( {\frac{{{\tau _j}}}{2} - i} \right) - \rho \left( i \right) - \rho \left( {{\tau _j} - i} \right)} \right]} }}{{\tau _j^2}}\sigma _X^2

where \sigma _X^2 is given by the variance of the ARMA process. Furthermore, this assumes that stationarity has been achieved as it directly

See Also

ARMAtoMA_cpp, ARMAacf_cpp, and arma11_to_wv


ARMA process to WV Approximation

Description

This function computes the (haar) WV of an ARMA process

Usage

arma_to_wv_app(ar, ma, sigma2, tau, alpha = 0.9999)

Arguments

ar

A vec containing the coefficients of the AR process

ma

A vec containing the coefficients of the MA process

sigma2

A double containing the residual variance

tau

A vec containing the scales e.g. 2^{\tau}

alpha

A double indicating the cutoff.

Details

This function provides an approximation to the arma_to_wv as computation times were previously a concern. However, this is no longer the case and, thus, this has been left in for the curious soul to discover...

Value

A vec containing the wavelet variance of the ARMA process.

Process Haar Wavelet Variance Formula

The Autoregressive Order p and Moving Average Order q (ARMA(p,q)) process has a Haar Wavelet Variance given by:

\frac{{{\tau _j}\left[ {1 - \rho \left( {\frac{{{\tau _j}}}{2}} \right)} \right] + 2\sum\limits_{i = 1}^{\frac{{{\tau _j}}}{2} - 1} {i\left[ {2\rho \left( {\frac{{{\tau _j}}}{2} - i} \right) - \rho \left( i \right) - \rho \left( {{\tau _j} - i} \right)} \right]} }}{{\tau _j^2}}\sigma _X^2

where \sigma _X^2 is given by the variance of the ARMA process. Furthermore, this assumes that stationarity has been achieved as it directly

Haar Wavelet Derivation Information

For more information, please see: blog post on SMAC group website.

See Also

ARMAtoMA_cpp, ARMAacf_cpp, acf_sum and arma_to_wv


Calculate Theoretical Allan Variance for Stationary First-Order Autoregressive (AR1) Process

Description

This function allows us to calculate the theoretical allan variance for stationary first-order autoregressive (AR1) process.

Usage

av_ar1(n, phi, sigma2)

Arguments

n

An integer value for the size of the cluster.

phi

A double value for the autocorrection parameter \phi.

sigma2

A double value for the variance parameter \sigma ^2.

Value

A double indicating the theoretical allan variance for AR1 process.

Note

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).

Author(s)

Yuming Zhang

Examples

av1 = av_ar1(n = 5, phi = 0.9, sigma2 = 1)
av2 = av_ar1(n = 8, phi = 0.5, sigma2 = 2)

Calculate Theoretical Allan Variance for Stationary White Noise Process

Description

This function allows us to calculate the theoretical allan variance for stationary white noise process.

Usage

av_wn(sigma2, n)

Arguments

sigma2

A double value for the variance parameter \sigma ^2.

n

An integer value for the size of the cluster.

Value

A double indicating the theoretical allan variance for the white noise process.

Note

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).

Author(s)

Yuming Zhang

Examples

av1 = av_wn(sigma2 = 1, n = 5)
av2 = av_wn(sigma2 = 2, n = 8)

Computes the MO/DWT wavelet variance for multiple processes

Description

Calculates the MO/DWT wavelet variance

Usage

batch_modwt_wvar_cpp(
  signal,
  nlevels,
  robust,
  eff,
  alpha,
  ci_type,
  strWavelet,
  decomp
)

Arguments

signal

A matrix that contains the same number of observations per dataset

robust

A boolean that triggers the use of the robust estimate.

eff

A double that indicates the efficiency as it relates to an MLE.

alpha

A double that indicates the \left(1-p\right)\times \alpha confidence level

ci_type

A string indicating the confidence interval being calculated. Valid value: "eta3"

strWavelet

A string indicating the type of wave filter to be applied. Must be "haar"

decomp

A string indicating whether to use "modwt" or "dwt" decomp

Details

This function processes the decomposition of multiple signals quickly

Value

A field<mat> with the structure:


Time Series Convolution Filters

Description

Applies a convolution filter to a univariate time series.

Usage

cfilter(x, filter, sides, circular)

Arguments

x

A column vector of length T

filter

A column vector of length f

sides

An int that takes either 1:for using past values only or 2: filter coefficients are centered around lag 0.

circular

A bool that indicates if the filter should be wrapped around the ends of the time series.

Details

This is a port of the cfilter function harnessed by the filter function in stats. It is about 5-7 times faster than R's base function. The benchmark was done on iMac Late 2013 using vecLib as the BLAS.

Value

A column vec that contains the results of the filtering process.

Author(s)

James J Balamuta


Generate eta3 confidence interval

Description

Computes the eta3 CI

Usage

ci_eta3(y, dims, alpha_ov_2)

Arguments

y

A vec that computes the modwt dot product of each wavelet coefficient divided by their length.

dims

A String indicating the confidence interval being calculated.

alpha_ov_2

A double that indicates the \left(1-p\right)*\alpha confidence level

Value

A matrix with the structure:


Generate eta3 robust confidence interval

Description

Computes the eta3 robust CI

Usage

ci_eta3_robust(wv_robust, wv_ci_class, alpha_ov_2, eff)

Arguments

wv_robust

A vec that computes the modwt dot product of each wavelet coefficient divided by their length.

wv_ci_class

A mat that contains the CI mean, CI Lower, and CI Upper

alpha_ov_2

A double that indicates the \left(1-p\right)*\alpha confidence level

eff

A double that indicates the efficiency.

Details

Within this function we are scaling the classical

Value

A matrix with the structure:


Generate a Confidence interval for a Univariate Time Series

Description

Computes an estimate of the multiscale variance and a chi-squared confidence interval

Usage

ci_wave_variance(
  signal_modwt_bw,
  wv,
  type = "eta3",
  alpha_ov_2 = 0.025,
  robust = FALSE,
  eff = 0.6
)

Arguments

signal_modwt_bw

A field<vec> that contains the modwt or dwt decomposition

wv

A vec that contains the wave variance.

type

A String indicating the confidence interval being calculated.

alpha_ov_2

A double that indicates the \left(1-p\right)*\alpha confidence level.

robust

A boolean to determine the type of wave estimation.

eff

A double that indicates the efficiency.

Details

This function can be expanded to allow for other confidence interval calculations.

Value

A matrix with the structure:


Comparison Between Multiple Wavelet Variances

Description

Displays plots of multiple wavelet variances of different time series accounting for CI values.

Usage

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
)

Arguments

...

One or more time series objects.

split

A boolean that, if TRUE, arranges the plots into a matrix-like format.

add_legend

A boolean that, if TRUE, adds a legend to the plot.

units

A string that specifies the units of time plotted on the x axes. Note: This argument will not be used if xlab is specified.

xlab

A string that gives a title for the x axes.

ylab

A string that gives a title for the y axes.

main

A string that gives an overall title for the plot.

col_wv

A string that specifies the color of the wavelet variance lines.

col_ci

A string that specifies the color of the confidence interval shade.

nb_ticks_x

An integer that specifies the maximum number of ticks for the x-axis.

nb_ticks_y

An integer that specifies the maximum number of ticks for the y-axis.

legend_position

A string that specifies the position of the legend (use legend_position = NA to remove legend).

ci_wv

A boolean that determines whether confidence interval polygons will be drawn.

point_cex

A double that specifies the size of each symbol to be plotted.

point_pch

A double that specifies the symbol type to be plotted.

names

A string that specifies the name of the WVAR objects.

cex_labels

A double that specifies the magnification of the labels (x and y).

x_range

A vector that specifies the range of values on the x axis (default NULL).

y_range

A vector that specifies the range of values on the y axis (default NULL).

Author(s)

Stephane Guerrier and Justin Lee

Examples

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)

Combined Plot Comparison Between Multiple Wavelet Variances

Description

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.

Usage

compare_wvar_no_split(graph_details)

Arguments

graph_details

List of inputs

Author(s)

Stephane Guerrier, Justin Lee, and Nathanael Claussen


Multi-Plot Comparison Between Multiple Wavelet Variances

Description

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.

Usage

compare_wvar_split(graph_details)

Arguments

graph_details

List of inputs

Author(s)

Stephane Guerrier, Justin Lee, and Nathanael Claussen


Create a wvar object

Description

Structures elements into a wvar object

Usage

create_wvar(
  obj,
  decomp,
  filter,
  robust,
  eff,
  alpha,
  scales,
  unit,
  mean_diff,
  N,
  ranged,
  J
)

Arguments

obj

A matrix with dimensions N x 3 that contains Wavelet Variance, Lower CI, and Upper CI.

decomp

A string that indicates whether to use a "dwt" or "modwt" decomposition.

filter

A string that specifies the type of wavelet filter used in the decomposition.

robust

A boolean that triggers the use of the robust estimate.

eff

A double that indicates the efficiency as it relates to an MLE.

alpha

A double that specifies the significance level which in turn specifies the 1-\alpha confidence level.

scales

A vec that contains the amount of decomposition performed at each level.

unit

A string that indicates the unit expression of the frequency.

mean_diff

A double that specified the empirical mean of the first difference.

N

A integer that specified the empirical length of the time series.

ranged

A double that specified the scaled range of the data, i.e. (max(x) - min(x))/length(x).

J

A integer that specified the number of scales.

Value

A list with the structure:


Each Models Process Decomposed to WV

Description

This function computes each process to WV (haar) in a given model.

Usage

decomp_theoretical_wv(theta, desc, objdesc, tau)

Arguments

theta

A vec containing the list of estimated parameters.

desc

A vector<string> containing a list of descriptors.

objdesc

A field<vec> containing a list of object descriptors.

tau

A vec containing the scales e.g. 2^{\tau}

Value

A mat containing the wavelet variance of each process in the model


Decomposed WV to Single WV

Description

This function computes the combined processes to WV (haar) in a given model.

Usage

decomp_to_theo_wv(decomp)

Arguments

decomp

A mat with scales as rows and processes as columns

Value

A vec containing the wavelet variance of the process for the overall model


Discrete Fourier Transformation for Autocovariance Function

Description

Calculates the autovariance function (ACF) using Discrete Fourier Transformation.

Usage

dft_acf(x)

Arguments

x

A cx_vec.

Details

This implementation is 2x as slow as Rs. Two issues: 1. memory resize and 2. unoptimized fft algorithm in arma. Consider piping back into R and rewrapping the object. (Decrease of about 10 microseconds.)

Value

A vec containing the ACF.


Lagged Differences in Armadillo

Description

Returns the ith difference of a time series of rth lag.

Usage

diff_cpp(x, lag, differences)

Arguments

x

A vec that is the time series

lag

A unsigned int that indicates the lag

differences

A dif that indicates how many differences should be taken

Value

A vector containing the differenced time series.

Author(s)

James J Balamuta


Drift to WV

Description

This function compute the WV (haar) of a Drift process

Usage

dr_to_wv(omega, tau)

Arguments

omega

A double corresponding to the slope of the drift

tau

A vec containing the scales e.g. 2^{\tau}

Value

A vec containing the wavelet variance of the drift.

Process Haar Wavelet Variance Formula

The Drift (DR) process has a Haar Wavelet Variance given by:

\nu _j^2\left( {{\omega }} \right) = \frac{{\tau _j^2{\omega ^2}}}{{16}}


Discrete Wavelet Transform

Description

Calculation of the coefficients for the discrete wavelet transformation

Usage

dwt(x, nlevels = floor(log2(length(x))), filter = "haar")

Arguments

x

A vector with dimensions N x 1.

nlevels

A integer indicating the J levels of decomposition.

filter

A string indicating the filter name

Details

Performs a level J decomposition of the time series using the pyramid algorithm. The default J is determined by floor\left(log_2 \left(length\left(x\right)\right)\right)

Value

A field<vec> that contains the wavelet coefficients for each decomposition level

Author(s)

James Balamuta, Justin Lee and Stephane Guerrier

Examples

set.seed(999)
x = rnorm(2^8)
ret = dwt(x)

summary(ret)

plot(ret)

Discrete Wavelet Transform

Description

Calculation of the coefficients for the discrete wavelet transformation.

Usage

dwt_cpp(x, filter_name, nlevels)

Arguments

x

A vector with dimensions N\times 1.

filter_name

A string indicating the filter.

nlevels

An integer, J, indicating the level of the decomposition.

Details

Performs a level J decomposition of the time series using the pyramid algorithm

Value

y A field<vec> that contains the wavelet coefficients for each decomposition level

Author(s)

James Balamuta and Justin Lee


Wavelet variance of IMU Data from IMAR Gyroscopes

Description

This data set contains wavelet variance of IMAR gyroscopes data.

Usage

imar_wv

Format

A list of the following elements:

Source

The IMU data comes from Geodetic Engineering Laboratory (TOPO) and Swiss Federal Institute of Technology Lausanne (EPFL).


Discrete Intergral: Inverse Difference

Description

Takes the inverse difference (e.g. goes from diff() result back to previous vector)

Usage

intgr_vec(x, xi, lag)

diff_inv_values(x, lag, d, xi)

diff_inv(x, lag, d)

Arguments

x

A vec containing the data

xi

A vec with length lag*d that provides initial values for the integration.

lag

An unsigned int indicating the lag between observations.

d

An unsigned int which gives the number of "differences" to invert.


Wavelet variance of IMU Data from a KVH1750 IMU sensor

Description

This data set contains wavelet variance of gyroscope and accelerometer data from an KVH1750 sensor.

Usage

kvh1750_wv

Format

A list of the following elements:

Source

The IMU data comes from Department of Geomatics Engineering, University of Calgary.


Wavelet variance of IMU Data from a LN200 sensor

Description

This data set contains wavelet variance of LN200 gyroscope and accelerometer data.

Usage

ln200_wv

Format

A list of the following elements:

Source

The IMU data comes from Geodetic Engineering Laboratory (TOPO) and Swiss Federal Institute of Technology Lausanne (EPFL).


Moving Average Order 1 (MA(1)) to WV

Description

This function computes the WV (haar) of a Moving Average order 1 (MA1) process.

Usage

ma1_to_wv(theta, sigma2, tau)

Arguments

theta

A double corresponding to the moving average term.

sigma2

A double the variance of the process.

tau

A vec containing the scales e.g. 2^{\tau}

Details

This function is significantly faster than its generalized counter part arma_to_wv.

Value

A vec containing the wavelet variance of the MA(1) process.

Process Haar Wavelet Variance Formula

The Moving Average Order 1 (MA(1)) process has a Haar Wavelet Variance given by:

\nu _j^2\left( {\theta ,{\sigma ^2}} \right) = \frac{{\left( {{{\left( {\theta + 1} \right)}^2}{\tau _j} - 6\theta } \right){\sigma ^2}}}{{\tau _j^2}}

See Also

arma_to_wv, arma11_to_wv


Mean of the First Difference of the Data

Description

The mean of the first difference of the data

Usage

mean_diff(x)

Arguments

x

A vec containing the data

Value

A double that contains the mean of the first difference of the data.


Maximum Overlap Discrete Wavelet Transform

Description

Calculates the coefficients for the discrete wavelet transformation

Usage

modwt(x, nlevels = floor(log2(length(x) - 1)), filter = "haar")

Arguments

x

A vector with dimensions N x 1.

nlevels

A integer indicating the J levels of decomposition.

filter

A string indicating the filter name

Details

Performs a level J decomposition of the time series using the pyramid algorithm. The default J is determined by floor\left(log_2 \left(length\left(x\right)\right)\right)

Value

A field<vec> that contains the wavelet coefficients for each decomposition level

Author(s)

James Balamuta, Justin Lee and Stephane Guerrier

Examples

set.seed(999)
x = rnorm(100)
ret = modwt(x)

summary(ret)

plot(ret)

Maximum Overlap Discrete Wavelet Transform

Description

Calculation of the coefficients for the discrete wavelet transformation

Usage

modwt_cpp(x, filter_name, nlevels)

Arguments

x

A vector with dimensions N\times 1.

filter_name

A string indicating the filter.

nlevels

An integer, J, indicating the level of the decomposition.

Details

Performs a level J decomposition of the time series using the pyramid algorithm. Use this implementation to supply custom parameters instead of modwt(x), which serves as a wrapper function.

Value

y A field<vec> that contains the wavelet coefficients for each decomposition level

Author(s)

James Balamuta and Justin Lee


Computes the (MODWT) wavelet variance

Description

Calculates the (MODWT) wavelet variance

Usage

modwt_wvar_cpp(
  signal,
  nlevels,
  robust,
  eff,
  alpha,
  ci_type,
  strWavelet,
  decomp
)

Arguments

signal

A vec that contains the data.

robust

A boolean that triggers the use of the robust estimate.

eff

A double that indicates the efficiency as it relates to an MLE.

alpha

A double that indicates the \left(1-p\right)\times \alpha confidence level

ci_type

A string indicating the confidence interval being calculated. Valid value: "eta3"

strWavelet

A string indicating the type of wave filter to be applied. Must be "haar"

decomp

A string indicating whether to use "modwt" or "dwt" decomp

Details

This function powers the wvar object. It is also extendable...

Value

A mat with the structure:


Description

This data set contains wavelet variance of gyroscope and accelerometer data from a navchip sensor.

Usage

navchip_wv

Format

A list of the following elements:

Source

The IMU data of the navchip sensor comes from Geodetic Engineering Laboratory (TOPO) and Swiss Federal Institute of Technology Lausanne (EPFL).


Replicate a Vector of Elements n times

Description

This function takes a vector and replicates all of the data n times

Usage

num_rep(x, n)

Arguments

x

A vec containing the data

n

An unsigned int indicating the number of times the vector should be repeated.

Value

A vec with repeated elements of the initial supplied vector.


Auto-Covariance and Correlation Functions

Description

The acf function computes the estimated autocovariance or autocorrelation for both univariate and multivariate cases.

Usage

## S3 method for class 'auto_corr'
plot(x, show.ci = TRUE, alpha = 0.05, main = NULL, ...)

Arguments

x

An "ACF" object from ACF.

show.ci

A bool indicating whether to show confidence region

...

Additional parameters

ci

A double containing the 1-alpha level. Default is 0.95

Value

An array of dimensions N \times S \times S.

Author(s)

Yunxiang Zhang

Examples

# Calculate the Autocorrelation
m = ACF(datasets::AirPassengers)

# Plot with 95% CI
plot(m) 

# Plot with 90% CI
plot(m, ci = 0.90) 

# Plot without 95% CI
plot(m, show.ci = FALSE)

Plot Discrete Wavelet Transform

Description

Plots results of the dwt list in which additional parameters can be specified

Usage

## S3 method for class 'dwt'
plot(x, index = NULL, couleur = NULL, ...)

Arguments

x

A dwt object.

index

A vector containing the indices to scales to be included in the graph. By default index = 1:(min(c(J,4))), where J denotes the number of scales in y.

couleur

A vector of colors of the same size as index used for the different scales depicted in the graph. If couleur contains a single value the the same color will be used for all scales.

...

additional arguments affecting the plot produced.

Author(s)

Justin Lee and Stephane Guerrier

Examples

# Simulate a Gaussian white noise
n = 10^3
Xt = rnorm(n)

# dwt
Yt = dwt(Xt)

# Graph examples
plot(Yt)
plot(Yt, index = c(1,4,5,6,8,2))
plot(Yt, index = c(1,4,5,6), couleur = "blue")
plot(Yt, index = c(1,4,5,6), couleur = rep(c("blue","yellow"),2))

Plot Wavelet Variance based on IMU Data

Description

Displays a plot of wavelet variance accounting for CI values and supplied efficiency.

Usage

## S3 method for class 'imu_wvar'
plot(
  x,
  xlab = NULL,
  ylab = NULL,
  main = NULL,
  col_wv = NULL,
  col_ci = NULL,
  nb_ticks_x = NULL,
  nb_ticks_y = NULL,
  ci_wv = NULL,
  point_cex = NULL,
  point_pch = NULL,
  ...
)

Arguments

x

A wvar object.

xlab

A string that gives a title for the x axis.

ylab

A string that gives a title for the y axis.

main

A string that gives an overall title for the plot.

col_wv

A string that specifies the color of the wavelet variance line.

col_ci

A string that specifies the color of the confidence interval polygon.

nb_ticks_x

An integer that specifies the maximum number of ticks for the x-axis.

nb_ticks_y

An integer that specifies the maximum number of ticks for the y-axis.

ci_wv

A boolean that determines whether a confidence interval polygon will be drawn.

point_cex

A double that specifies the size of each symbol to be plotted.

point_pch

A double that specifies the symbol type to be plotted.

...

Additional arguments affecting the plot.

Value

Plot of wavelet variance and confidence interval for each scale.

Author(s)

Stephane Guerrier and Yuming Zhang

Examples

data("kvh1750_wv")
plot(kvh1750_wv)

Plot Maximum Overlap Discrete Wavelet Transform

Description

Plots results of the modwt list in which additional parameters can be specified

Usage

## S3 method for class 'modwt'
plot(x, index = NULL, couleur = NULL, ...)

Arguments

x

A modwt object.

index

A vector containing the indices to scales to be included in the graph. By default index = 1:(min(c(J,4))), where J denotes the number of scales in y.

couleur

A vector of colors of the same size as index used for the different scales depicted in the graph. If couleur contains a single value the the same color will be used for all scales.

...

additional arguments affecting the plot produced.

Author(s)

Justin Lee and Stephane Guerrier

Examples

# Simulate a Gaussian white noise
n = 10^3
Xt = rnorm(n)

# MODWT
Yt = modwt(Xt)

# Graph examples
plot(Yt)
plot(Yt, index = c(1,4,5,6,8,2))
plot(Yt, index = c(1,4,5,6), couleur = "blue")
plot(Yt, index = c(1,4,5,6), couleur = rep(c("blue","yellow"),2))

Plot Cross Covariance Pair

Description

Plots results of the a wccv_pair list in which additional parameters can be specified

Usage

## S3 method for class 'wccv_pair'
plot(
  x,
  theo.wccv = NULL,
  main = NULL,
  xlab = NULL,
  ylab = NULL,
  units = NULL,
  col_wccv = NULL,
  col_ci = NULL,
  nb_ticks_x = NULL,
  nb_ticks_y = NULL,
  ...
)

Author(s)

Justin Lee, Haotian Xu, and Stephane Guerrier

Examples

n = 10^5
Xt = cumsum(rnorm(n, 0, 0.01))
Wt = Xt + rnorm(n)
Yt = Xt + rnorm(n)
wcov = wccv_pair(Wt, Yt)
plot(wcov)

Plot Wavelet Variance

Description

Displays a plot of wavelet variance accounting for CI values and supplied efficiency.

Usage

## S3 method for class 'wvar'
plot(
  x,
  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,
  ...
)

Arguments

x

A wvar object.

units

A string that specifies the units of time plotted on the x axis.

xlab

A string that gives a title for the x axis.

ylab

A string that gives a title for the y axis.

main

A string that gives an overall title for the plot.

col_wv

A string that specifies the color of the wavelet variance line.

col_ci

A string that specifies the color of the confidence interval polygon.

nb_ticks_x

An integer that specifies the maximum number of ticks for the x-axis.

nb_ticks_y

An integer that specifies the maximum number of ticks for the y-axis.

legend_position

A string that specifies the position of the legend (use legend_position = NA to remove legend).

ci_wv

A boolean that determines whether a confidence interval polygon will be drawn.

point_cex

A double that specifies the size of each symbol to be plotted.

point_pch

A double that specifies the symbol type to be plotted.

...

Additional arguments affecting the plot.

Value

Plot of wavelet variance and confidence interval for each scale.

Author(s)

Stephane Guerrier, Nathanael Claussen, and Justin Lee

Examples

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")

Print Discrete Wavelet Transform

Description

Prints the results of the modwt list

Usage

## S3 method for class 'dwt'
print(x, ...)

Arguments

x

A dwt object

...

further arguments passed to or from other methods.

Value

Prints the dwt decomposition

Author(s)

James Balamuta and Nathanael Claussen

Examples

set.seed(999)
x = rnorm(2^8)
print(dwt(x))

Print Maximum Overlap Discrete Wavelet Transform

Description

Prints the results of the modwt list

Usage

## S3 method for class 'modwt'
print(x, ...)

Arguments

x

A modwt object

...

further arguments passed to or from other methods.

Value

Prints the modwt decomposition

Author(s)

James Balamuta and Nathanael Claussen

Examples

set.seed(999)
x = rnorm(100)
print(modwt(x))

Print Wavelet Variances

Description

Displays the summary table of wavelet variance.

Usage

## S3 method for class 'wvar'
print(x, ...)

Arguments

x

A wvar object.

...

Further arguments passed to or from other methods.

Value

Summary table

Author(s)

James Balamuta

Examples

set.seed(999)
x = rnorm(100)
out = wvar(x)
print( out )

Quantisation Noise (QN) to WV

Description

This function compute the Haar WV of a Quantisation Noise (QN) process

Usage

qn_to_wv(q2, tau)

Arguments

q2

A double corresponding to variance of drift

tau

A vec containing the scales e.g. 2^{\tau}

Value

A vec containing the wavelet variance of the QN.

Process Haar Wavelet Variance Formula

The Quantization Noise (QN) process has a Haar Wavelet Variance given by:

\nu _j^2\left( {{Q^2}} \right) = \frac{{6{Q^2}}}{{\tau _j^2}}


Find Quantiles

Description

Attempts to find quantiles

Usage

quantile_cpp(x, probs)

Arguments

x

A vec of data

probs

A vec of the quantiles to find.

Value

A vector containing the quantiles

Author(s)

James J Balamuta


Time Series Recursive Filters

Description

Applies a recursive filter to a univariate time series.

Usage

rfilter(x, filter, init)

Arguments

x

A column vector of length T

filter

A column vector of length f

init

A column vector of length f that contains the initial values of the time series in reverse.

Details

Note: The length of 'init' must be equal to the length of 'filter'. This is a port of the rfilter function harnessed by the filter function in stats. It is about 6-7 times faster than R's base function. The benchmark was done on iMac Late 2013 using vecLib as the BLAS.

Value

x A column vector with its contents reversed.

Author(s)

James J Balamuta


Comparison between classical and robust Wavelet Variances

Description

Displays a plot of the wavelet variances (classical and robust) for a given time series accounting for CI values.

Usage

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,
  ...
)

Arguments

x

A time series objects.

eff

An integer that specifies the efficiency of the robust estimator.

units

A string that specifies the units of time plotted on the x axis.

xlab

A string that gives a title for the x axis.

ylab

A string that gives a title for the y axis.

main

A string that gives an overall title for the plot.

col_wv

A string that specifies the color of the wavelet variance line.

col_ci

A string that specifies the color of the confidence interval shade.

nb_ticks_x

An integer that specifies the maximum number of ticks for the x-axis.

nb_ticks_y

An integer that specifies the maximum number of ticks for the y-axis.

legend_position

A string that specifies the position of the legend (use legend_position = NA to remove legend).

...

Additional arguments affecting the plot.

Value

Plot of wavelet variance and confidence interval for each scale.

Author(s)

Stephane Guerrier, Nathanael Claussen, and Justin Lee

Examples

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")

Random Walk to WV

Description

This function compute the WV (haar) of a Random Walk process

Usage

rw_to_wv(gamma2, tau)

Arguments

gamma2

A double corresponding to variance of RW

tau

A vec containing the scales e.g. 2^{\tau}

Value

A vec containing the wavelet variance of the random walk.

Process Haar Wavelet Variance Formula

The Random Walk (RW) process has a Haar Wavelet Variance given by:

\nu _j^2\left( {{\gamma ^2}} \right) = \frac{{\left( {\tau _j^2 + 2} \right){\gamma ^2}}}{{12{\tau _j}}}


Calculates Length of Seasonal Padding

Description

Computes the total phi and total theta vector length.

Usage

sarma_calculate_spadding(np, nq, nsp, nsq, ns)

Arguments

np

An unsigned int containing the number of non-seasonal phi parameters.

nq

An unsigned int containing the number of non-seasonal theta parameters.

nsp

An unsigned int containing the number of seasonal phi parameters.

nsq

An unsigned int containing the number of seasonal theta parameters.

Value

A vec with rows:

p

Number of phi parameters

q

Number of theta parameters

See Also

sarma_components


Determine parameter expansion based upon objdesc

Description

Calculates the necessary vec space needed to pad the vectors for seasonal terms.

Usage

sarma_components(objdesc)

Arguments

objdesc

A vec with the appropriate sarima object description

Value

A vec with the structure:

np

Number of Non-Seasonal AR Terms

nq

Number of Non-Seasonal MA Terms

nsp

Number of Seasonal AR Terms

nsq

Number of Seasonal MA Terms

ns

Number of Seasons (e.g. 12 is year)

p

Total number of phi terms

q

Total number of theta terms


Expand Parameters for an SARMA object

Description

Creates an expanded PHI and THETA vector for use in other objects.

Usage

sarma_expand(params, objdesc)

Arguments

params

A vec containing the theta values of the parameters.

objdesc

A vec containing the model term information.

Details

The objdesc is assumed to have the structure of:

Value

A field<vec> of size two as follows:


(Internal) Expand the SARMA Parameters

Description

(Internal) Expand the SARMA Parameters

Usage

sarma_expand_unguided(params, np, nq, nsp, nsq, ns, p, q)

Arguments

params

A vec containing the theta values of the parameters.

np

An unsigned int containing the number of non-seasonal phi parameters.

nq

An unsigned int containing the number of non-seasonal theta parameters.

nsp

An unsigned int containing the number of seasonal phi parameters.

nsq

An unsigned int containing the number of seasonal theta parameters.

p

An unsigned int that is the total size of the phi vector.

q

An unsigned int that is the total size of the theta vector.

Value

A field<vec> that contains the expansion.


Create the ts.model obj.desc given split values

Description

Computes the total phi and total theta vector length.

Usage

sarma_objdesc(ar, ma, sar, sma, s, i, si)

Arguments

ar

A vec containing the non-seasonal phi parameters.

ma

A vec containing the non-seasonal theta parameters.

sar

A vec containing the seasonal phi parameters.

sma

A vec containing the seasonal theta parameters.

s

An unsigned integer containing the frequency of seasonality.

i

An unsigned integer containing the number of non-seasonal differences.

si

An unsigned integer containing the number of seasonal differences.

Value

A vec with rows:

np

Number of Non-Seasonal AR Terms

nq

Number of Non-Seasonal MA Terms

nsp

Number of Seasonal AR Terms

nsq

Number of Seasonal MA Terms

nsigma

Number of Variances (always 1)

s

Season Value

i

Number of non-seasonal differences

si

Number of Seasonal Differences


Efficient way to merge items together

Description

Efficient way to merge items together

Usage

sarma_params_construct(ar, ma, sar, sma)

Computes the MODWT scales

Description

Calculates the MODWT scales

Usage

scales_cpp(nb_level)

Arguments

nb_level

A integer that contains the level of decomposition J.

Details

Used in wvar object.

Value

A vec that contains 2^1, ... , 2^J


Generate a sequence of values

Description

Creates a vector containing a sequence of values starting at the initial point and going to the terminal point.

Usage

seq_cpp(a, b)

Arguments

a

An int, that denotes the starting point.

b

An int, that denotes the ending point.

Value

A vector containing values moving from a to b. There are no restrictions on A's range.

Author(s)

James J Balamuta


Generate a sequence of values based on supplied number

Description

Creates a vector containing a sequence of values starting at 1 and going to the terminal point.

Usage

seq_len_cpp(n)

Arguments

n

An int that denotes the length of the vector.

Value

A vector containing values moving from 1 to n.

Author(s)

James J Balamuta


Haar filter for a spatial case

Description

Haar filter for a spatial case

Usage

sp_hfilter(jscale)

Arguments

jscale

An int of the Number of Scales


Compute the Spatial Wavelet Coefficients

Description

Compute the Spatial Wavelet Coefficients

Usage

sp_modwt_cpp(X, J1, J2)

Arguments

X

is a matrix with row, col orientation

J1, J2

is the levels of decomposition along the rows, columns

Details

By default this function will return the wavelet coefficient in addition to the wavelet

Value

A list of vectors containing the wavelet coefficients.


Summary Discrete Wavelet Transform

Description

Prints DWT object in a concise format

Usage

## S3 method for class 'dwt'
summary(object, ...)

Arguments

object

A dwt object

...

additional arguments affecting the summary produced.

Value

Prints the dwt matrix decomposition

Author(s)

Nathanael Claussen and Justin Lee

Examples

set.seed(999)
x = rnorm(2^8)
summary(dwt(x))

Summary Maximum Overlap Discrete Wavelet Transform

Description

Prints MODWT object in a concise format

Usage

## S3 method for class 'modwt'
summary(object, ...)

Arguments

object

A modwt object

...

additional arguments affecting the summary produced.

Value

Prints the modwt matrix decomposition

Author(s)

Nathanael Claussen and Justin Lee

Examples

set.seed(999)
x = rnorm(100)
summary(modwt(x))

Summary of Wavelet Variances

Description

Displays the summary table of wavelet variance accounting for CI values and supplied efficiency.

Usage

## S3 method for class 'wvar'
summary(object, ...)

Arguments

object

A wvar object.

...

Additional arguments affecting the summary produced.

Value

Summary table and other properties of the object.

Author(s)

James Balamuta

Examples

set.seed(999)
x = rnorm(100)
ret = wvar(x)
summary(ret)

Model Process to WV

Description

This function computes the summation of all Processes to WV (haar) in a given model

Usage

theoretical_wv(theta, desc, objdesc, tau)

Arguments

theta

A vec containing the list of estimated parameters.

desc

A vector<string> containing a list of descriptors.

objdesc

A field<vec> containing a list of object descriptors.

tau

A vec containing the scales e.g. 2^{\tau}

Value

A vec containing the wavelet variance of the model.


Convert Unit of Time Series Data

Description

Manipulate the units of time to different ones

Usage

unitConversion(x, from.unit, to.unit)

Arguments

x

A vector containing the values on x-axis.

from.unit

A string indicating the unit which the data is converted from.

to.unit

A string indicating the unit which the data is converted to.

Details

The supported units are "ns"(nanosecond), "ms"(millisecond), "sec", "min", "hour", "day", "month", and "year". Make sure from.unit and to.unit are not NULL before it is passed to this function.

Value

A list with the following structure:

Examples

x = seq(60, 3600, 60)
unitConversion(x, 'sec', 'min')
y = 1:10
unitConversion(y, 'hour', 'sec')

Generate a Wave Variance for a Univariate Time Series

Description

Computes an estimate of the wave variance

Usage

wave_variance(signal_modwt_bw, robust = FALSE, eff = 0.6)

Arguments

signal_modwt_bw

A field<vec> that contains the modwt or dwt decomposition

robust

A boolean to determine the type of wave estimation.

eff

A double that indicates the efficiency.

Value

A vec that contains the wave variance.


Cross Covariance of Matrix

Description

Calculates the Cross-covariance between multiple wavelet transfomations (dwt or modwt)

Usage

wccv(x, decomp = "modwt", filter = "haar", nlevels = NULL)

Arguments

x

A vector with dimensions N x M.

decomp

A string that indicates whether to use the "dwt" or "modwt" decomposition.

filter

A string that specifies what wavelet filter to use.

nlevels

An integer that indicates the level of decomposition. It must be less than or equal to floor(log2(length(x))).

Details

If nlevels is not specified, it is set to \left\lfloor {{{\log }_2}\left( {length\left( x \right)} \right)} \right\rfloor

Value

Returns a matrix of lists of all the possible pair cross-covariance, variance of each wavelet cross-covariance and its 95

Author(s)

Justin Lee


Mapping to log10 scale

Description

Map x to the value in log10 scale

Usage

wccv_get_y(x, tick_y_min, tick_y_step)

Arguments

x

A vector with dimensions J x 1.

tick_y_min

A negtive integer the minimum power of 10, which corresponds to the smallest scale on y-axis.

tick_y_step

An integer indicating the increment of the sequence.

Details

tick_y_min is usually chosen as floor(min(log10(abs(x))))

Value

A field<vec> that contains values in log10 scale.

Author(s)

James Balamuta and Justin Lee

Examples

x = 2^(-1:-9)
y.min = floor(min(log10(abs(x))))
y.step = 2
wccv_get_y(x, y.min, y.step)

Cross Covariance of a TS Pair

Description

Calculates the Cross-covariance between two wavelet transfomations (dwt or modwt)

Usage

wccv_pair(x, y, decomp = "modwt", filter = "haar", nlevels = NULL)

Arguments

x

A vector with dimensions N x 1.

y

A vector with dimensions N x 1.

decomp

A string that indicates whether to use the "dwt" or "modwt" decomposition.

filter

A string that specifies what wavelet filter to use.

nlevels

An integer that indicates the level of decomposition. It must be less than or equal to floor(log2(length(x))).

Details

If nlevels is not specified, it is set to \left\lfloor {{{\log }_2}\left( {length\left( x \right)} \right)} \right\rfloor

Value

Returns a list of a matrix containing cross-covariance, variance of each wavelet cross-covariance and its 95

Author(s)

Justin Lee


Gaussian White Noise to WV

Description

This function compute the Haar WV of a Gaussian White Noise process

Usage

wn_to_wv(sigma2, tau)

Arguments

sigma2

A double corresponding to variance of WN

tau

A vec containing the scales e.g. 2^{\tau}

Value

A vec containing the wavelet variance of the white noise.

Process Haar Wavelet Variance Formula

The Gaussian White Noise (WN) process has a Haar Wavelet Variance given by:

\nu _j^2\left( {{\sigma ^2}} \right) = \frac{{{\sigma ^2}}}{{\tau _j^2}}


Wavelet Variance

Description

Calculates the (MO)DWT wavelet variance

Usage

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,
  ...
)

Arguments

x

A vector with dimensions N x 1.

...

Further arguments passed to or from other methods.

decomp

A string that indicates whether to use a "dwt" or "modwt" decomposition.

filter

A string that specifies which wavelet filter to use.

nlevels

An integer that indicates the level of decomposition. It must be less than or equal to floor(log2(length(x))).

alpha

A double that specifies the significance level which in turn specifies the 1-\alpha confidence level.

robust

A boolean that triggers the use of the robust estimate.

eff

A double that indicates the efficiency as it relates to an MLE.

to.unit

A string indicating the unit to which the data is converted.

freq

A numeric that provides the rate of samples.

from.unit

A string indicating the unit from which the data is converted.

Details

The default value of nlevels will be set to \left\lfloor {{{\log }_2}\left( {length\left( x \right)} \right)} \right\rfloor, unless otherwise specified.

Value

A list with the structure:

Author(s)

James Balamuta, Justin Lee and Stephane Guerrier

Examples

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)

Computes the (MODWT) wavelet variance

Description

Calculates the (MODWT) wavelet variance

Usage

wvar_cpp(signal_modwt_bw, robust, eff, alpha, ci_type)

Arguments

signal_modwt_bw

A field<vec> that contains the modwt decomposition after it has been brick walled.

robust

A boolean that triggers the use of the robust estimate.

eff

A double that indicates the efficiency as it relates to an MLE.

alpha

A double that indicates the \left(1-p\right)*\alpha confidence level

ci_type

A String indicating the confidence interval being calculated. Valid value: "eta3"

Details

This function does the heavy lifting with the signal_modwt_bw

Value

A mat with the structure: