movQtUE: Moving quantile_UE(Moving Median, Moving Minimum, Moving... In RcppMovStat: Fast Moving Statistics Calculation

Description

This function returns A matrix: the first column is the position, the second column the input vector, and third column moving quantile_UE of the given vector.

Usage

 ```1 2 3 4 5``` ```movQtUE(vec, pos, n = 1L, prob = 0.5, ss = 1L, na_rm = FALSE, sizeD = FALSE, align = "left") movQtUEr(vec, pos, n = 1L, prob = 0.5, ss = 1L, na_rm = FALSE, sizeD = FALSE) ```

Arguments

 `vec` A numeric vector. `pos` A numeric vector with all integers. Its length must be the SAME as vec. N.B. We use integers to represent the (relative) positions of every point. `n` An integer: moving window size, with 1 as default `prob` A number: between 0 and 1, meaning prob quantile_UE `ss` An integer: step size, only calculating at points with an equal distance ss. Namely, there are ss-1 number between each two 'consecutive' points `na_rm` logical. Should missing values (including NaN) be removed? `sizeD` logical. Only applied when ss > 1, it decides whether to get a result of smaller size. If sizeD = T, align does not affect the output. `align` A string denotes how to align the moving average, three options: "left", "middle", "right"

Details

This function is especially designed for Unevenly Spaced Time Series. It is efficient as it inherits the similar routine of `movQt`.
The result is kind of tricky. To make it clear, it is written to return a MATRIX. For instance, the third column of the output of second example is 2.5, NA, NA, NA, NA, NA, 3.0, NA, NA. 2.5 is the median of 1 and 4, and 4.0 the average of 4. The third column of the output of third example is the every third element starting from nth number.
For how weights, w, work, one can refer to `movQt`.

Value

This function returns A MATRIX of size: L*3, where L is the length of vector, or of size: L1*3, where L1 = `ceiling`((nrow - n + 1)/ss), (when sizeD = T). In the matrix, the first column denotes the position, the second column the original vector, and the third column the moving average.

Functions

• `movQtUEr`: An function equivalent to `movQtUE(..., align = "right")`

Examples

 ```1 2 3 4 5``` ```movQtUE(c(1, 4, 3, NA, 8), pos = c(1, 2, 7, 8, 9), n = 2, ss = 3, na_rm = TRUE) movQtUE(c(1, 4, 3, NA, 8), pos = c(1, 2, 7, 8, 9), n = 2, ss = 3, na_rm = TRUE, sizeD = TRUE) movQtUE(c(1, 4, 3, NA, 8), pos = c(1, 2, 7, 8, 9), n = 2, na_rm = TRUE, align = "middle") movQtUE(c(1, 4, 3, NA, 8), pos = c(1, 2, 7, 8, 9), n = 2, ss = 3, na_rm = TRUE, sizeD = TRUE, align = "right") ```

RcppMovStat documentation built on Jan. 30, 2018, 5:04 p.m.