DeepMed: DeepMediation: De-biased Deep Learning for Semi-parametric...

Description Usage Arguments Details Value References Examples

View source: R/DeepMed.R

Description

De-biased Deep Learning for Semi-parametric Causal Mediation Analysis

Usage

1
DeepMed(y,d,m,x,hyper_grid,epochs=500,hyper,cv=TRUE,trim=0.05)

Arguments

y

A numeric vector for the outcome variable in causal mediation analysis.

d

A numeric vector for the exposure variable in causal mediation analysis, which should be a binary variable with values being 0 or 1.

m

A numeric vector for the mediator variable in causal mediation analysis.

x

A numeric matrix for the covariates in causal mediation analysis.

hyper_grid

A grid of candidate hyperparameters for deep neural networks. It is a numeric matrix with three columns for numbers of hidden units, numbers of hidden layers, and L1 regularizition parameters in the input layer, respecively. "hyper_grid" should be provided if cv==TRUE, then a 3-fold cross-validation will be used to select the hyperparameters.

epochs

The maximum number of candidate epochs.

hyper

The hyperparameters of neural networks, i.e., L1 regularizition parameters, numbers of hidden layers, numbers of hidden units and epochs. The neural networks with hyperparameters specified by "hyper" will be used in a 3-fold cross-fitting to estiamte the nuisance parameters in the influence functions for the mean potential outcomes. "hyper" should be provided if cv==FALSE

cv

If cv==TRUE, then "hyper_grid" should be provided and a 3-fold cross-validation will be used to select hyperparameters among "hyper_grid". Otherwise, hyperparameters should be provided in the argument "hyper".

trim

The trimming rate for preventing conditional treatment or mediator probabilities from being zero. Observations with any denominators in the potential outcomes smaller than the trimming rate will be excluded from the analysis.

Details

All binary variables in the data should be coded as 0 or 1.

Value

results

The estimates (effect), standard errors (se) and P values (p-val) of the total treatment effect (total), (in)direct treatment effect in treated ((in)dir.treat), and (in)direct treatment effect in control group ((in)indir.control).

ntrimmed

The number of observations being excluded due to the denominators in the potential outcomes smaller than the trimming rate.

References

Xu S, Liu L and Liu Z. De-biased Deep Learning for Semi-parametric Causal Mediation Analysis. 2021

Examples

1
2
3
4
5
6
7
8
9
library(DeepMediation)
# use parallel computation with 30 cores for a grid search of hyperparameters
library(doMC); registerDoMC(30)

l1 = c(0,0.05,0.1)
layer = c(1:3)
unit = c(10,20,50)
hyper_grid=expand.grid(unit,layer,l1) # create a grid of candidate hyperparameters
DeepMed(y,d,m,x,hyper_grid,cv=TRUE)

siqixu/DeepMediation documentation built on Dec. 23, 2021, 2:30 a.m.