Statistics: Statistics of Estimated Value of Causal Mediation Effects

StatisticsR Documentation

Statistics of Estimated Value of Causal Mediation Effects

Description

This function calculates the statistics of mediation effects risk difference (RD), odds ratio (OR) and risk ratio (RR) scales based on the bootstrapping results. The statistics include the mean value, standard error, t-statistics, p-value and confident interval. The way to realize bootstrapping estimations is also specified in this function, either through the ordinal for loop, or the multi-threading process.

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

Usage

Statistics (m_model, y_model, data, X, M, Y,
m_type, y_type, boot_num = 100, MT = TRUE, Cf_lv = 0.95)

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.

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.

MT

a logical value indicating whether the multi-threading process is activated. If TURE, activating max-1 cores. If FALSE, use the ordinary 'for' loop. The default is TRUE.

Cf_lv

a numeric variable of the confidence interval. The value is presented in decimal form, not percentage form. The default is 0.95.

Details

This function also detects the treatment group and control group when the exposure is not a continuous variable. The function deals with o-1 exposure, character and factor exposure and then displays the grouping information for users.

Value

This function returns a list of three dataframes, i.e., statistics of the mediation effects risk difference (RD), odds ratio (OR) and risk ratio (RR) scales respectively. The statistics include the mean value, standard error, t-statistics, p-value and confident interval based on the bootstrapping estimations.


unvs.med documentation built on June 8, 2025, 10:15 a.m.