simulate_fosr: Simulate a function-on-scalar regression model

Description Usage Arguments Value Note Examples

View source: R/helper_functions.R

Description

Simulate data from a function-on-scalar regression model, allowing for subject-specific random effects. The predictors are multivariate normal with mean zero and covariance corr^abs(j1-j2) for correlation parameter corr between predictors j1 and j2. More predictors than observations (p > n) is allowed.

Usage

1
2
simulate_fosr(n = 100, m = 50, RSNR = 5, K_true = 4, p_0 = 1000,
  p_1 = 5, sparse_factors = TRUE, corr = 0, perc_missing = 0)

Arguments

n

number of observed curves (i.e., number of subjects)

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

sparse_factors

logical; if TRUE, then for each nonzero predictor j, sample a subset of k=1:K_true factors to be nonzero#'

corr

correlation parameter for predictors

perc_missing

percentage 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 FOSR
sim_data = simulate_fosr(n = 100, m = 20, p_0 = 100, p_1 = 5)
Y = sim_data$Y; X = sim_data$X; tau = sim_data$tau

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