med_rint: Random interventional analogue effects

Description Usage Arguments Details Value Examples

View source: R/med_rint.R

Description

med_rint computes NDEr, NIEr and TEr, the random interventional analogues of the natural direct effect, natural indirect effect and total effect, in the presence of exposure-induced confounding of M -> Y. Gives bootstrapped confidence interval. To do: extend to multiple confounders. Might or might not work at the moment.

Usage

1
2
med_rint(dat, A, M, Y, C = NULL, L = NULL, astar = "astar", boot = 10,
  quants = c(0.025, 0.5, 0.975), nmin = 20, mids = NULL, maxit = 5)

Arguments

dat

The original dataset

A

the exposure of interest. Must be binary or categorical

M

the mediators of interest. Must be binary or categorical

Y

the outcome, currently must be continuous

C

confounders of either X -> M and/or M -> Y. Can take any form, specified as formula

L

the exposure-induced confounder of the association of M with Y. Must be binary or categorical

boot

specifies the number of bootstrap samples drawn to make the confidence intervals. Default is 10 for testing purposes

quants

an optional vector of quantiles for the confidence interval (95 percent by default)

nmin

number of participants all categories of exposure must have; samples will be redrawn if this criterion is not met

mids

an optional mids object to serve as template for imputations

mlvl

a matrix or table of probability-mass functions for the mediator, to calculate CDE(M). By default, mlvl is set to the observed sample distributions

Details

The procedure is described in chapter 5.4.2 of Tyler's book

Value

An S3 object of class cmed.ipw containing:

nde mean and 95p confidence intervals for NDEr

nie mean and 95p confidence intervals for NIEr

te mean and 95p confidence intervals for the total effect

ter mean and 95p confidence intervals for the random interventional analogue to the total effect

boots a list with nde, nie, te, and ter resutls for each bootstrap sample

raw a list of the duplicated dataset and intermediary propensity scores calculated from original data (not resampled)

Examples

1
my_list <- med_rint(dat = mydat,  A = my_exposure, Y = my_outcome, M = my_mediator, C = a_confounder + another_confounder, L = my_problem, boot = 1000)

kaskarn/causamed documentation built on Dec. 28, 2021, 11:01 a.m.