get_causaleffect {BCDAG}R Documentation

Estimate total causal effects from the MCMC output

Description

This function provides causal effect estimates from the output of learn_DAG

Usage

get_causaleffect(learnDAG_output, targets, response, verbose = TRUE)

Arguments

learnDAG_output

object of class bcdag

targets

numerical (p,1) vector with labels of target nodes

response

numerical label of response variable

verbose

if TRUE, progress bar of MCMC sampling is displayed

Details

Output of learn_dag function consists of S draws from the joint posterior of DAGs and DAG-parameters in a zero-mean Gaussian DAG-model; see the documentation of learn_DAG for more details.

The total causal effect on a given variable of interest (response) consequent to a joint intervention on a set of variables (targets) is defined according to Pearl's do-calculus theory and under the Gaussian assumption can be expressed as a function of parameters (D,L), representing a (Cholesky) reparameterization of the covariance matrix.

Specifically, to each intervened variable a causal effect coefficient is associated and the posterior distribution of the latter can be recovered from posterior draws of the DAG parameters returned by learn_DAG. For each coefficient a sample of size S from its posterior is available. If required, the only Bayesian Model Average (BMA) estimate (obtained as the sample mean of the S draws) can be returned by setting BMA = TRUE.

Notice that, whenever implemented with collapse = FALSE, learn_DAG returns the marginal posterior distribution of DAGs only. In this case, get_causaleffect preliminarly performs posterior inference of DAG parameters by drawing samples from the posterior of (D,L).

Print, summary and plot methods are available for this function. print returns the values of the prior hyperparameters used in the learnDAG function. summary returns, for each causal effect parameter, the marginal posterior mean and quantiles for different \alpha levels, and posterior probabilities of negative, null and positive causal effects. plot provides graphical summaries (boxplot and histogram of the distribution) for the posterior of each causal effect parameter.

Value

An S3 object of class bcdagCE containing S draws from the joint posterior distribution of the p causal effect coefficients, organized into an (S,p) matrix, posterior means and credible intervals (under different (1-\alpha) levels) for each causal effect coefficient, and marginal posterior probabilities of positive, null and negative causal effects.

Author(s)

Federico Castelletti and Alessandro Mascaro

References

J. Pearl (2000). Causality: Models, Reasoning, and Inference. Cambridge University Press, Cambridge.

F. Castelletti and A. Mascaro (2021) Structural learning and estimation of joint causal effects among network-dependent variables. Statistical Methods and Applications, Advance publication.

P. Nandy, M.H. Maathuis and T. Richardson (2017). Estimating the effect of joint interventions from observational data in sparse high-dimensional settings. Annals of Statistics 45(2), 647-674.

Examples

# Randomly generate a DAG and the DAG-parameters
q = 8
w = 0.2
set.seed(123)
DAG = rDAG(q = q, w = w)
outDL = rDAGWishart(n = 1, DAG = DAG, a = q, U = diag(1, q))
L = outDL$L; D = outDL$D
Sigma = solve(t(L))%*%D%*%solve(L)
n = 200
# Generate observations from a Gaussian DAG-model
X = mvtnorm::rmvnorm(n = n, sigma = Sigma)
# Run the MCMC (set S = 5000 and burn = 1000 for better results)
out_mcmc = learn_DAG(S = 500, burn = 100, a = q, U = diag(1,q)/n, data = X, w = w,
                     fast = TRUE, save.memory = FALSE)
head(out_mcmc$Graphs)
head(out_mcmc$L)
head(out_mcmc$D)
# Compute the BMA estimate of coefficients representing
# the causal effect on node 1 of an intervention on {3,4}
out_causal = get_causaleffect(learnDAG_output = out_mcmc, targets = c(3,4), response = 1)$post_mean

# Methods
print(out_causal)
summary(out_causal)
plot(out_causal)

[Package BCDAG version 1.1.1 Index]