Learn R Programming

unvs.med (version 1.1.0)

BootEstimation_MT: Bootstrapping Estimation for Causal Mediation Effects via Multi-threading Process

Description

This function obtains the estimates of mediation effects via non-parametric bootstrapping. Through bootstrap sampling and repeating the algorithm of function SingleEstimation, This function obtains a number of estimates for each type of effect.

This is an internal function, automatically called by the function Statistics.

Usage

BootEstimation_MT (m_model, y_model, data, X, exp0=NULL, exp1=NULL,
M, Y, m_type, y_type, boot_num = 100)

Value

This function returns a list of three dataframes, i.e., the bootstrapping results of the mediation effects. This list is also saved in the return of the main function FormalEstmed.

Arguments

m_model

a fitted model object for the mediator.

y_model

a fitted model object for the outcome.

data

a dataframe used in the analysis.

X

a character variable of the exposure's name.

exp0

a numeric variable of the baseline level of the exposure.

exp1

a numeric variable of the new level of the exposure.

M

a character variable of the mediator's name.

Y

a character variable of the outcome's name.

m_type

a character variable of the mediator's type.

y_type

a character variable of the outcome's type.

boot_num

the times of bootstrapping in the analysis. The default is 100.

Details

This function activates the multi-threading process through package 'snowfall' in R with max-1 cores (CPU) of the PC.