# \donttest{
# 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 via bootstrapping
# Plot examples
plot(r1) # Plot of the default settings (plot PNED and TNDE on RD scales).
plot(r1,"OR") # Plot PNDE and TNIE on OR scales.
plot(r1,c("RD", "OR")) # Plot PNED and TNDE on RD and OR scales.
# Plot five types of the effects on RD and OR scales:
plot(r1,c("RD", "OR"), c("TE","PNDE", "TNDE", "PNIE", "TNIE"))
plot(r1,c("RD", "RR"), "all") # Plot all the effects on RD and RR scales.
plot(r1, scale=c("RD", "OR", "RR"), type="all") # Plot all the effects on all scales.
# }
Run the code above in your browser using DataLab