padVector: Increase data length to the closest power of 2.

Description Usage Arguments Details Value Author(s) See Also Examples


To use the WiSE bootstrap methodology in this package, data must be of length T=2^J for some positive integer, J. This function increases the length of data to achieve the particular length requirement. Generally, this function is useful for data pre-processing.


padVector(X, type = "reflect", pad.direction = "both", 
          replaceLinearTrend = FALSE)



a vector of data. This must be numeric and non-missing.


how to increase the data length. Allowed values are "reflect", "periodic", or "mean". The "reflect" option repeats values proceeding the end/beginning of the series (ex: 12345 --> 12345432). The "periodic" option repeats the series in order (ex: 12345 --> 12345123). The "mean" option repeats the series mean (ex: 12345 --> 12345333 ).


where to add the data padding. Allowed values are "both", "front", or "rear". The "both" option pads data on both sides of the series (ex: 12345 --> 31234533). The "front" option pads data on the beginning of the series (ex: 12345 --> 33312345). The "rear" option pads data on the end of the series (ex: 12345 --> 12345333).


logical. If TRUE, the estimated linear trend is replaced in the returned data. If FALSE, the estimated trend is not replaced in the returned data. See Details for more information.


If the data supplied is already a power of 2, this function will just return the original or de-trended data.

If the data supplied is of length, t, the padded data returned will be of length T=2^{ceiling(log(t, base=2))}.

The data length T=2^J for a positive integer, J, requirement is associated with the discrete wavelet transform. Although methodology exists in the wavelet literature which allows for data series of any length, this methodology does not align with the theory behind WiSE bootstrap.

The replaceLinearTrend option allows the user to control whether linear trend appears in the padded data. The linear trend (by data index) is estimated using least squares for the data series. This trend is removed before padding the data. The estimated trend may or may not be replaced to the padded data. The linear trend consists of the data intercept and slope (by index).



a vector of padded data. This vector will be of length T instead of t (see Details).


a vector of 2 indices. These indicate where the original data is in the padded series. Note, the xPad will not exactly match the original data between these indices, since the linear trend has been estimated (and possibly replaced).


a vector of 2 numbers. The first is the least squares estimated intercept and the second is the least squares estimated slope (by index) from the data originally supplied.


Megan Heyman

See Also

padMatrix, wavethresh-package


someData <- seq(1,9)+ rnorm(9)

padVector(someData, type="mean", pad.direction="rear") 
padVector(someData, type="periodic", pad.direction="front") 

WiSEBoot documentation built on May 2, 2019, 12:35 p.m.