| simulate_fps_data | R Documentation |
Generates a synthetic dataset for testing and illustrating the FPScausal workflow.
simulate_fps_data(
n = 200,
setting = c("LL", "LN", "NL", "NN"),
outcome_type = c("scalar", "functional"),
p_scalar = 3,
include_functional_cov = TRUE,
domain = c(0, 1),
seed = NULL
)
n |
Integer. Number of subjects (default 200). |
setting |
Character. One of '"LL"', '"LN"', '"NL"', '"NN"', where the first letter controls the treatment-confounder relationship and the second controls the confounder-outcome relationship. Default '"LL"'. |
outcome_type |
Character. Either '"scalar"' or '"functional"'. Default '"scalar"'. |
p_scalar |
Integer. Number of scalar confounders. Default 3. |
include_functional_cov |
Logical. If 'TRUE' (default), include one functional covariate D(t) in the returned list. |
domain |
Numeric vector |
seed |
Integer or NULL. Random seed for reproducibility. |
**Treatment** X_i(t) is built from 6 Fourier eigenfunctions with eigenvalues (16, 12, 8, 4, 1, 0.5). **Scalar confounders** C_i are 3-dimensional vectors whose relationship to X's FPC scores is either linear or quadratic. An optional **functional covariate** D_i(t) is generated from 4 Fourier components. The **scalar outcome** is Y_i = 1 + integral(beta(t) * X_i(t)) + g(C_i) + N(0,25), and the **functional outcome** is Y_i(t) = mu0(t) + integral(mu(s,t) * X_i(s) ds) + h(D_i) + GP_error.
The four settings ("LL", "LN", "NL", "NN") vary whether the treatment-confounder ("L"inear / "N"onlinear) and confounder-outcome ("L"inear / "N"onlinear) relationships are linear or quadratic.
A named list with:
n x 51 matrix. Observed treatment trajectories on [0,1].
If 'outcome_type = "scalar"': numeric vector of length n. If 'outcome_type = "functional"': n x 51 matrix.
n x p_scalar matrix. Scalar confounders.
n x 51 matrix. Functional covariate (if 'include_functional_cov = TRUE', else 'NULL').
Numeric vector of 51 equally-spaced points on [0,1].
True causal effect. For scalar outcome: numeric vector of length 51. For functional outcome: 51 x 51 matrix mu(s,t).
The 'setting' argument used.
The 'outcome_type' argument used.
dat <- simulate_fps_data(n = 100, setting = "LL", outcome_type = "scalar",
seed = 42)
str(dat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.