Simulate simple sample dataset for BKMRCMA illustration, function to generate simulated data with multiple exposures and true mediated effect
cma_sampledata(N, L, P, scenario, seed)a data frame
dat <- cma_sampledata(N=300, L=3, P=3, scenario=1, seed=7)
head(dat$data, n = 3L)
#> z1 z2 z3 M x1 x2
#> 1 2.1398615 0.66567853 -0.80106452 0.6239949 -1.00620320 0.4650244
#> 2 -1.1923396 -0.42173859 -0.07880356 -0.2518323 -0.07811248 0.1077124
#> 3 -0.7254667 -0.09880639 -0.45684941 -0.2787926 -1.44686488 -0.4673260
#> x3 y
#> 1 -0.7528264 1.047106
#> 2 -0.2061189 -1.554507
#> 3 -0.2041117 -1.071443