bmem: Mediation analysis based on bootstrap

View source: R/bmem.R

bmemR Documentation

Mediation analysis based on bootstrap

Description

Mediation analysis based on bootstrap

Usage

bmem(data, model, v, method='list', ci='perc', cl=.95, 
     boot=1000, m=10, varphi=.1, st='i', robust=FALSE, 
     max_it=500, parallel=FALSE, ncore=1,  ...)

Arguments

data

A data set

model

RAM path for the mediaiton model

v

Indices of variables used in the mediation model. If omitted, all variables are used.

method

list: listwise deletion, pair: pairwise deletion, mi: multiple imputation, em: EM algorithm.

ci

norm: normal approximation CI, perc: percentile CI, bc: bias-corrected CI, bca: BCa

cl

Confidence level. Can be a vector.

boot

Number of bootstraps

m

Number of imputations

varphi

Percent of data to be downweighted in robust method

st

Starting values

robust

Whether to use roubst method

max_it

Maximum number of iterations in EM

parallel

Whether to use parallel method to calculate.

ncore

Number of cores for parallel method.

...

Other options for sem function can be used.

Details

The indirect effect can be specified using equations such as a*b, a*b+c, and a*b*c+d*e+f, which can be defined in 'model' parameter.

Value

The on-screen output includes the parameter estimates, bootstrap standard errors, and CIs.

Author(s)

Zhiyong Zhang, Shuigen Ming and Lijuan Wang

References

Zhang, Z., & Wang, L. (2013). Methods for mediation analysis with missing data. Psychometrika, 78(1), 154-184. doi: 10.1007/s11336-012-9301-5

Yuan, KH., Zhang, Z. Robust Structural Equation Modeling with Missing Data and Auxiliary Variables. Psychometrika 77, 803-826 (2012). doi: 10.1007/s11336-012-9282-4

Examples

data("PoliticalDemocracy")

model_l <- '
ind60 =~ x1 + g*x2 + h*x3
dem60 =~ y1 + d*y2 + e*y3 + f*y4
dem65 =~ y5 + d*y6 + e*y7 + f*y8

dem60 ~ a * ind60
dem65 ~ c * ind60 + b * dem60

y1 ~~ y5
y2 ~~ y4 + y6
y3 ~~ y7
y4 ~~ y8
y6 ~~ y8
ind := a*b
'

fit_l <- bmem(data=PoliticalDemocracy, model = model_l, method='list', 
      ci='perc', boot=50, parallel = TRUE, ncore = 8)
summary(fit_l)

bmemLavaan documentation built on May 28, 2022, 5:06 p.m.

Related to bmem in bmemLavaan...