simulate_dfosr: Simulate a dynamic function-on-scalars regression model

Description Usage Arguments Value Note Examples

View source: R/helper_functions.R

Description

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.

Usage

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)

Arguments

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

Value

a list containing the following:

Note

The basis functions (or loading curves) are orthonormalized polynomials, so large values of K_true are not recommended.

Examples

1
2
3
# Example: simulate DFOSR
sim_data = simulate_dfosr()
Y = sim_data$Y; X = sim_data$X; tau = sim_data$tau

drkowal/dfosr documentation built on May 7, 2020, 3:09 p.m.