Description Usage Arguments Value Note Examples
View source: R/helper_functions.R
Simulate data from a dynamic function-on-scalars regression model, allowing for autocorrelated errors and (possibly) dynamic regression coefficients random effects. The predictors are contemporaneously independent but (possibly) autocorrelated.
1 2 3 | simulate_dfosr(T = 200, m = 100, RSNR = 5, K_true = 4, p_0 = 2,
p_1 = 2, use_dynamic_reg = TRUE, sparse_factors = FALSE,
use_obs_SV = FALSE, ar1 = 0, prop_missing = 0)
|
T |
number of observed curves (i.e., number of time points) |
m |
total number of observation points (i.e., points along the curve) |
RSNR |
root signal-to-noise ratio |
K_true |
rank of the model (i.e., number of basis functions used for the functional data simulations) |
p_0 |
number of true zero regression coefficients |
p_1 |
number of true nonzero regression coefficients |
use_dynamic_reg |
logical; if TRUE, simulate dynamic regression coefficients; otherwise static |
sparse_factors |
logical; if TRUE, then for each nonzero predictor j, sample a subset of k=1:K_true factors to be nonzero |
use_obs_SV |
logical; if TRUE, include stochastic volatility term for the error variance |
ar1 |
AR(1) coefficient for time-correlated predictors |
prop_missing |
proportion of missing data (between 0 and 1); default is zero |
a list containing the following:
Y
: the simulated T x m
functional data matrix
X
: the simulated T x p
design matrix
tau
: the m
-dimensional vector of observation points
Y_true
: the true T x m
functional data matrix (w/o noise)
alpha_tilde_true
the true T x p x m
array of regression coefficient functions
alpha_arr_true
the true T x p x K_true
array of (dynamic) regression coefficient factors
Beta_true
the true T x K_true
matrix of factors
F_true
the true m x K_true
matrix of basis (loading curve) functions
sigma_true
the true observation error standard deviation
The basis functions (or loading curves) are orthonormalized polynomials,
so large values of K_true
are not recommended.
1 2 3 | # Example: simulate DFOSR
sim_data = simulate_dfosr()
Y = sim_data$Y; X = sim_data$X; tau = sim_data$tau
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.