um.test1: Test of Mediation Effects Within One Single Object

View source: R/um.test1.R

um.test1R Documentation

Test of Mediation Effects Within One Single Object

Description

This function tests the difference of various types of effects within one single estimation object from function FormalEstmed. It is used to compare whether an effect is distinct from another.

Usage

um.test1 (obj, scale = "RD",type = c("PNDE", "TNIE"), Cf_lv=0.95, verbose=TRUE)

Arguments

obj

a resulting object of class "unvs.med" from function FormalEstmed.

scale

a character variable of the effect scales. It can be "RD", "OR" or "RR". The default is "RD".

type

a character variable of the effect types, containing more than two. The default is c("PNDE", "TNIE").

Cf_lv

a numeric variable of the confident interval. The default is 0.95.

verbose

a logical value indicating whether the output is display. The default is TRUE. This is a standard parameter required by CRAN.

Value

No return value, called for displaying the output of the test result.

Examples


# Running formal estimation
data(testdata)
med_model=glm(med~exp+C1+C2+C3, data=testdata, family=binomial) # Fitting mediator's model
out_model=lm(out~med*exp+C1+C2+C3, data=testdata) # Fitting outcome's model
r1 = FormalEstmed (med_model=med_model, out_model=out_model,
data=testdata, exposure = "exp") # Running formal estimation

# Test examples
um.test1(r1) # Test of the default settings (PNDE v.s. TNIE on RD scales).
um.test1(r1,"OR") # Test of PNDE v.s. TNIE on OR scales.
# Test of PNDE v.s. TNIE on RD and OR scales:
um.test1(r1,c("RD", "OR"))
# Test of PNDE v.s. TNIE v.s. TE on RD and OR scales:
um.test1(r1,c("RD", "OR"), c("PNDE", "TNIE", "TE"))
# Test of PNDE v.s. TNIE v.s. TE on RD, OR and RR scales:
um.test1(r1, scale=c("RD", "OR", "RR"), type=c("PNDE", "TNIE", "TE"))


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