um.test2 | R Documentation |
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.
um.test2 (obj1, obj2, scale = "RD", type = c("PNDE", "TNIE"), Cf_lv=0.95, verbose=TRUE)
obj1 |
a resulting object of class |
obj2 |
a resulting object of class |
scale |
a character variable of the effect scales. It can be |
type |
a character variable of the effect types, containing more than two.
The default is |
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. |
No return value, called for displaying the output of the test result.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.