um.test2: Test of Mediation Effects Between Two Objects

View source: R/um.test2.R

um.test2R Documentation

Test of Mediation Effects Between Two Objects

Description

This function tests the difference of various types of effects between two estimation objects from function FormalEstmed. It is used to compare whether an effect is distinct from another between two different estimation settings.

Usage

um.test2 (obj1, obj2, scale = "RD", type = c("PNDE", "TNIE"), Cf_lv=0.95, verbose=TRUE)

Arguments

obj1

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

obj2

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+exp*C1+C2+C3, data=testdata, family=binomial) # Fitting mediator's model
out_model=lm(out~med*exp+exp*C1+C2+C3, data=testdata) # Fitting outcome's model
r1 = FormalEstmed (med_model=med_model, out_model=out_model,
data=testdata, exposure = "exp", cov_val="C1==1") # Conditioning on C1=1
r0 = FormalEstmed (med_model=med_model, out_model=out_model,
data=testdata, exposure = "exp", cov_val="C1==0") # Conditioning on C1=0

# Test examples
um.test2(r1,r0) # Test of the default settings (PNDE v.s. TNIE on RD scales).
um.test2(r1,r0, c("OR", "RR")) # Test of PNDE v.s. TNIE on OR and RR scales.
# Test of PNDE v.s. TNIE v.s. TE on OR and RR scales:
um.test2(r1,r0, c("OR", "RR"), c("PNDE", "TNIE", "TE"))
# Test of PNDE v.s. TNIE v.s. TE on OR and RR scales with 90% CI:
um.test2(r1,r0, c("OR", "RR"), c("PNDE", "TNIE", "TE"), Cf_lv=0.9)


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