library(permediatr) library(lme4) attach(list(nreps = 1, nperms = 500, mc.cores = 7, J = 100, n_j = 10, a = 0, b = .5, c_p = 0, theta_ab = .2, optimizer = 'bobyqa')) adf <- simulate_mediation_data(J = J, n_j = n_j, a = a, b = b, c_p = c_p, theta_ab = theta_ab) ab_mod <- permediatr::lmemm_within(data = adf, y.name = 'y', x.name = 'x_wc', m_b.name = 'm_wc', m_a.name = 'm', group.id = 'id', covariates.y=c('cov.y', 'm_bc', 'x_bc'), covariates.m=c('cov.m', 'x_bc'), random.a=T, random.b=T, random.c_p=T, optimizer = optimizer) ab <- indirectEffect(ab_mod) boot_rez <- permediatr::run_simulation(3, niter = 500, mc.cores = 7, simtype = 'bootstrap', J = 100, n_j = 10, a = 0, b = 0, c_p = 0, theta_ab = .2, optimizer = 'bobyqa', re.form = NA, boottype = 'parametric') data.table::rbindlist(lapply(boot_rez, as.data.frame))
system.time({oneboot <- permediatr::boot_ab(ab_mod, nsim = 250, ncpus = 7, re.form = NA, type = 'cases', how = 'both', seed = 1)}) twoboot <- permediatr::boot_ab(ab_mod, nsim = 1000, ncpus = 7, re.form = NA, type = 'cases', how = 'both', seed = 1) threeboot <- permediatr::boot_ab(ab_mod, nsim = 1000, ncpus = 7, re.form = NA, type = 'cases', how = 'both', seed = 123123) rbind(summary(oneboot),summary(twoboot), summary(threeboot)) do.call(rbind, list(summary(oneboot, 'ab'), summary(oneboot, 'a'), summary(oneboot, 'b')))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.