# \donttest{
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)
# }
Run the code above in your browser using DataLab