| sim_pvarife | R Documentation |
Generates synthetic panel data from the DGP of Tugan (2021), Section S10,
with a single common factor following an AR(1) process and factor loadings
drawn from N(1, 1).
sim_pvarife(
n_units = 50L,
n_time = 30L,
n_vars = 2L,
n_lags = 1L,
n_factors = 1L,
identification = c("short_run", "long_run"),
seed = 42L
)
n_units |
Positive integer. Number of cross-sectional units |
n_time |
Positive integer. Number of time periods |
n_vars |
Positive integer. Number of VAR variables |
n_lags |
Positive integer. VAR lag order (default 1; higher lags use zero coefficient matrices). |
n_factors |
Positive integer. Number of common factors (default 1; each factor has its own AR(1) process and independent loadings). |
identification |
Character. |
seed |
Optional integer seed for reproducibility (default 42). |
The data generating process is:
y_{i,t} = c + \Theta_1 y_{i,t-1} + f_t \lambda_i + A_0 \varepsilon_{i,t},
where
\Theta_1 = \begin{pmatrix} 0.65 & 0.30 \\ 0.20 & 0.60 \end{pmatrix},
\quad \Sigma_e = \begin{pmatrix} 1 & 0.5 \\ 0.5 & 1 \end{pmatrix},
f_t = 0.5 f_{t-1} + \eta_t, \; \eta_t \sim N(0, 0.5),
\lambda_{k,i} \sim N(1, 1) \;\text{(independently)},
and A_0 = \mathrm{chol}(\Sigma_e)^\top (Cholesky identification). A
burn-in of 1000 periods is discarded.
For n_vars = 2 and n_lags = 1, the parameters match the MATLAB
GeneratingSynteticDataSets.m (Short-Run identification variant).
A list with:
Array of dimension I \times T \times K (unit \times
time \times variable). No missing values.
True coefficient vector, same format as fit$beta.
True VAR coefficient array K \times K \times n\_lags.
True reduced-form covariance matrix K \times K.
True structural impact matrix K \times K.
T \times n\_factors matrix of true factors.
K \times n\_units matrix of true loadings.
The identification scheme used ("short_run"
or "long_run").
Integer vector: variables that should be
cumulated in compute_irf(). integer(0) for short-run;
1L for long-run (to display cumulative responses, matching the
MATLAB MC code's DifferencedVariables = [1]).
sim <- sim_pvarife(n_units = 30, n_time = 20, n_vars = 2,
n_lags = 1, n_factors = 1, seed = 1)
dim(sim$y) # 30 x 20 x 2
sim$beta_true
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.