Description Usage Arguments Examples
View source: R/get_trend_windows.R
consensus ADMM
Uses ADMM to smooth overlapping windows
1 2 3 | get_trend_windows(y, tau, lambda, k, window_size, overlap, max_iter,
rho = 1, update = 10, use_gurobi = TRUE, eps_abs = 0.05,
eps_rel = 0.001, scale = TRUE)
|
y |
observed data |
tau |
quantile levels at which to evaluate trend |
lambda |
smoothing penalty parameter |
k |
order of differencing |
window_size |
size of windows to use |
overlap |
integer length of overlap between windows |
max_iter |
Maximum number of iterations |
rho |
parameter for ADMM |
update |
number of iterations at which to print residuals |
use_gurobi |
TRUE if gurobi solver is installed and should be used |
eps_abs |
absolute threshold for stopping criteria |
eps_rel |
relative threshold for stopping criteria |
scale |
(TRUE/FALSE) scale response before estimating trend |
1 2 3 4 5 6 7 8 9 10 11 12 13 | require(Matrix)
n <- 100
x <- seq(1, n, 1)
y <- sin(x*2*pi/n) + rnorm(n, 0, .4)
lambda <- 10
k <- 3
y_n <- length(y)
overlap <- 20
window_size <- round((y_n+overlap)/2)
tau <- c(0.05, .2)
max_iter <- 20
trend <- get_trend_windows(y, tau, lambda, k, window_size, overlap, max_iter)
plot(trend[,1]~x, type="l")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.