simVAR {bigtime} | R Documentation |
Simulates a VAR(p) with various sparsity patterns
Description
Simulates a VAR(p) with various sparsity patterns
Usage
simVAR(
periods,
k,
p,
coef_mat = NULL,
const = rep(0, k),
e_dist = rnorm,
init_y = rep(0, k * p),
max_abs_eigval = 0.8,
burnin = periods,
sparsity_pattern = c("none", "lasso", "L1", "hvar", "HLag"),
sparsity_options = NULL,
decay = 1/p,
seed = NULL,
...
)
Arguments
periods |
Scalar indicating the desired time series length |
k |
Number of time series |
p |
Maximum lag number. In case of |
coef_mat |
Coefficient matrix in companion form. If not provided, one will be simulated |
const |
Constant term of VAR. Default is zero. Must be either a scalar, in which case it will be broadcasted to a k-vector, or a k-vector |
e_dist |
Either a function taking argument n indicating the number of variables in the system, or a matrix of dimensions k x (periods+burnin) |
init_y |
Initial values. Defaults to zero. Expects either a scalar or a vector of length (k*p) |
max_abs_eigval |
Maximum allowed eigenvalue of companion matrix. Only applicable if coefficient matrix is being simulated |
burnin |
Number of time points to be used for burnin |
sparsity_pattern |
The sparsity pattern that should be simulated.
Options are: |
sparsity_options |
Named list of additional options for
when sparsity pattern is lasso (L1) or hvar (HLag). For lasso (L1) the option |
decay |
How much smaller should parameters for later lags be. The smaller, the larger will early parameters be w.r.t. later ones. |
seed |
Seed to be used for the simulation |
... |
Additional arguments passed to |
Value
Returns an object of S3 class bigtime.simVAR
containing the following
Y |
Simulated Data |
periods |
Time series length |
k |
Number of endogenous variables |
p |
Maximum lag length; effective lag length might be shorter due to sparsity patterns |
coef_mat |
Companion form of the coefficient matrix. Will be of
dimensions ( |
is_coef_mat_simulated |
|
const |
Constant term |
e_dist |
Errors used in the construction of the data |
init_y |
Initial conditions |
max_abs_eigval |
Maximum eigenvalue to which the companion matrix was constraint |
burnin |
Burnin period used |
sparsity_pattern |
Sparsity pattern used |
sparsity_options |
Extra options for the sparsity patterns used |
seed |
Seed used for the simulation |
Examples
periods <- 200 # time series length
k <- 5 # number of variables
p <- 10 # maximum lag
sparsity_pattern <- "HLag" # HLag sparsity structure
sparsity_options <- list(zero_min = 0, # variables can be included with all lags
zero_max = 10, # but some could also include no lags
zeroes_in_self = TRUE)
sim <- simVAR(periods=periods, k=k, p=p, sparsity_pattern=sparsity_pattern,
sparsity_options=sparsity_options, seed = 12345)
summary(sim)