Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ciee

CIEE: Causal inference based on estimating equations


Description

Functions to perform CIEE under the GLM or AFT setting: ciee obtains point and standard error estimates of all parameter estimates, and p-values for testing the absence of effects; ciee_loop performs ciee in separate analyses of multiple exposure variables with the same outcome measures and factors ond only returns point estimates, standard error estimates and p-values for the exposure variables. Both functions can also compute estimates and p-values from the two traditional regression methods and from the structural equation modeling method.

Usage

ciee(setting = "GLM", estimates = c("ee", "mult_reg", "res_reg", "sem"),
  ee_se = c("sandwich"), BS_rep = NULL, Y = NULL, X = NULL, K = NULL,
  L = NULL, C = NULL)

ciee_loop(setting = "GLM", estimates = c("ee", "mult_reg", "res_reg",
  "sem"), ee_se = c("sandwich"), BS_rep = NULL, Y = NULL, X = NULL,
  K = NULL, L = NULL, C = NULL)

Arguments

setting

String with value "GLM" or "AFT" indicating whether a normally-distributed ("GLM") or censored time-to-event ("AFT") primary outcome Y is analyzed.

estimates

String vector with possible values "ee", "mult_reg", "res_reg", "sem" indicating which methods are computed. "ee" computes CIEE, "mult_reg" the traditional multiple regression method, "res_reg" the traditional regression of residuals method, and "sem" the structural equation modeling approach. Multiple methods can be specified.

ee_se

String with possible values "sandwich", "bootstrap", "naive" indicating how the standard error estimates of the parameter estiamtes are computed for CIEE approach. "sandwich" computes the robust sandwich estimates (default, recommended), "bootstrap" the bootstrap estimates and "naive" the naive unadjusted standard error estimates (not recommended, only for comparison). One method has to be specified.

BS_rep

Integer indicating the number of bootstrap samples that are drawn (recommended 1000) if bootstrap standard errors are computed.

Y

Numeric input vector for the primary outcome.

X

Numeric input vector for the exposure variable if the ciee function is used; or numeric input dataframe containing the exposure variables as columns if the ciee_loop function is used.

K

Numeric input vector for the intermediate outcome.

L

Numeric input vector for the observed confounding factor.

C

Numeric input vector for the censoring indicator under the AFT setting (must be coded 0 = censored, 1 = uncensored).

Details

For the computation of CIEE, point estimates of the parameters are obtained using the get_estimates function. Robust sandwich (recommended), bootstrap, or naive standard error estimates of the parameter estimates are obtained using the sandwich_se, bootstrap_se or naive_se function. Large-sample Wald-type tests are performed for testing the absence of effects, using either the robust sandwich or bootstrap standard errors.

Regarding the traditional regression methods, the multiple regression or regression of residual approaches can be computed using the mult_reg and res_reg functions. Finally, the structural equation modeling approachcan be performed using the sem_appl function.

Value

Object of class ciee, for which the summary function summary.ciee is implemented. ciee returns a list containing the point and standard error estimates of all parameters as well as p-values from hypothesis tests of the absence of effects, for each specified approach. ciee_loop returns a list containing the point and standard error estimates only of the exposure variables as well as p-values from hypothesis tests of the absence of effects, for each specified approach.

Examples

# Generate data under the GLM setting with default values
maf <- 0.2
n <- 100
dat <- generate_data(n = n, maf = maf)
datX <- data.frame(X = dat$X)
names(datX)[1] <- "X1"
# Add 9 more exposure variables names X2, ..., X10 to X
for (i in 2:10){
  X <- stats::rbinom(n, size = 2, prob = maf)
  datX$X <- X
  names(datX)[i] <- paste("X", i, sep="")
}

# Perform analysis of one exposure variable using all four methods
ciee(Y = dat$Y, X = datX$X1, K = dat$K, L = dat$L)

# Perform analysis of all exposure variables only for CIEE
ciee_loop(estimates = "ee", Y = dat$Y, X = datX, K = dat$K, L = dat$L)

CIEE

Estimating and Testing Direct Effects in Directed Acyclic Graphs using Estimating Equations

v0.1.1
GPL-2
Authors
Stefan Konigorski [aut, cre], Yildiz E. Yilmaz [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.