lmi_simul_dat {CompMix} | R Documentation |
Simulate data from linear model with interactions
Description
Simulate data from linear model with interactions
Usage
lmi_simul_dat(
n,
p,
q,
block_idx = c(1, 1, 2, 2, 3, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3),
sigma2_x = 1,
within_rho = 0.6,
btw_rho = 0.2,
R2 = 0.8,
effect_size = 1,
effect_size_i = 1,
cancel_effect = TRUE
)
Arguments
n |
a positive integer to indicate sample size |
p |
a positive integer to specify the number of exposures |
q |
a positive integer to specify the number of non-zero effects |
block_idx |
a vector of positive integers to indicate the block IDs. The length of the vector is p. |
sigma2_x |
a positive numeric scalar for variance of the covariates |
within_rho |
a numeric scalar between 0 and 1 for the within block correlation |
btw_rho |
a numeric scalar between 0 and 1 for the between block correlation |
R2 |
a numeric scalar for R-squared |
effect_size |
a numeric scalar for effect size for main effect |
effect_size_i |
a numeric scalar for effect size for interaction effect |
cancel_effect |
a logic value to indicate whether there is effect cancelation |
Value
a list object of the following
- x
covariate matrix of dimension n by p
- n
sample size
- p
number of covariates
- sigma2_x
variance
- within_rho
within block correlation
- btw_rho
between block correaltion
- block_idx
block indices
Author(s)
Wei Hao <weihao@umich.edu>