View source: R/Functions_BSS_SGL.R
lag_selection | R Documentation |
Select the lag of the VAR model (if the lag is unknown) using BIC method for total segments
lag_selection(
data,
method = c("sparse", "group sparse", "fLS"),
group.case = c("columnwise", "rowwise"),
group.index = NULL,
lambda.1.cv = NULL,
lambda.2.cv = NULL,
mu = NULL,
block.size = NULL,
blocks = NULL,
use.BIC = TRUE,
an.grid = NULL,
threshold = NULL,
lag_candidates,
verbose = FALSE
)
data |
input data matrix, each column represents the time series component |
method |
method is sparse, group sparse and fixed lowrank plus sparse |
group.case |
two different types of group sparse, column-wise and row-wise, respectively. |
group.index |
specify group sparse index. Default is NULL. |
lambda.1.cv |
tuning parameter lambda_1 for fused lasso |
lambda.2.cv |
tuning parameter lambda_2 for fused lasso |
mu |
tuning parameter for low rank component, only available when method is set to "fLS". |
block.size |
the block size |
blocks |
the blocks |
use.BIC |
use BIC for k-means part |
an.grid |
a vector of an for grid searching. |
threshold |
a numeric argument, give the threshold for estimated model parameter matrices. Default is NULL. |
lag_candidates |
potential lag selection set |
verbose |
A Boolean argument, if TRUE, it provides detailed information. Default is FALSE |
selected lag for VAR series
An integer no less than 1 represents the selected lag of time series.
nob <- 1000; p <- 15
brk <- c(floor(nob / 2), nob + 1)
m <- length(brk)
q.t <- 2 # the lag of VAR model for simulation
signals <- c(-0.8, 0.6, 0.4)
try <- simu_var(method = "sparse", nob = nob, k = p, brk = brk,
signals = signals, lags_vector = c(1, 2),
sp_pattern = "off-diagonal")
data <- try$series; data <- as.matrix(data)
# Apply lag selection to determine the lag for the given time series
lag_candi <- c(1, 2, 3, 4)
select_lag <- lag_selection(data = data,
method = "sparse", lag_candidates = lag_candi)
print(select_lag)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.