reverseMAsim: reverseMAsim

Description Usage Arguments Value Author(s)

View source: R/reverseMAsim.R

Description

A function to simulate the performance of the mediate function from the mediation package in scenarios of reverse causality.

Usage

1
2
3
4
5
reverseMAsim(n = 1000, pX = 0.2, gamma0 = 0, gammaX = 0.1,
  varM = 1, beta0 = 0, betaX = 1, betaM = c(0, 0.1, 0.2),
  varY = 1, nSim = 100, nSimImai = 1000, SEED = 1, plot.pdf = T,
  plot.name = "reverseMAsim.pdf", alpha_level = 0.05,
  use_multi_processing = F, use_cpp = F, num_jobs = 1)

Arguments

n

is the sample size.

pX

is the minor allele frequency

gamma0

is the intercept for M

gammaX

is the association of X with M

varM

is the variance of M

beta0

is the intercept for Y

betaX

is the direct effect of X on Y

betaM

is a vector of different associations of M with Y

varY

is the variance of Y

nSim

is the number of simulations to run

nSimImai

is the number of simulations to run in mediate from the mediation package

SEED

is the seed

plot.pdf

is T to output a plot, is F to not output a plot

plot.name

is the name of the plot

alpha_level

is the significance level

use_multi_processing

use multi_processing instead of threading for a speed boost

use_cpp

use Rcpp with Eigen

num_jobs

the number of cores to use, i.e. the number of parallel procesess or threads to spawn

Value

a matrix of the power of the mediate method from the mediation package to detect an effect of the mediator M on the outcome Y when M and Y are correctly specified and also when they are incorrectly specified (the true mediator is Y and the true outcome is M)

Author(s)

Annie Thwing, Sharon Lutz


SharonLutz/reverseCT documentation built on Oct. 30, 2019, 11:54 p.m.