Description Usage Arguments Details Value References Examples
Estimate the average causal effect (ACE) of a given treatment variable
X on a given outcome Y by adjusting for a set S of covariates (equivalenly, assuming
S blocks all backdoor paths in the causal graph that generates the observations). . Bounds are based on finding conditional instrumental variables
using the faithfulness assumption relaxed to allow for a moderate degree of unfaithfulness.
Candidate models are generated from the method described in covsearch.
1 | bindagCausalEffectBackdoor(problem, prior_table, S)
|
problem |
a |
prior_table |
effective sample size hyperparameter of a Dirichlet prior for testing independence with contingency tables. |
S |
an array indicating the indices of the covariates used in the adjustment. |
The algorithm implemented is a naive one. If the dimensionality of S is larger than around 20, this may crash the system.
This function is assumed to be used along other methods such as covsearch and wpp, which generate
relativelty small covariate sets.
the estimated ACE.
Pearl, J. (2000) Causality: Models, Reasoning and Inference. Cambridge University Press.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ## Generate a synthetic problem
problem <- simulateWitnessModel(p = 4, q = 4, par_max = 3, M = 1000)
## Idealized case: suppose we know the true distribution,
## get "exact" ACE estimands for different adjustment sets
sol_pop <- covsearch(problem, pop_solve = TRUE)
effect_pop <- synthetizeCausalEffect(problem)
cat(sprintf(
"ACE (true) = %1.2f\nACE (adjusting for all) = %1.2f\nACE (adjusting for nothing) = %1.2f\n",
effect_pop$effect_real, effect_pop$effect_naive, effect_pop$effect_naive2))
## Perform inference and report results
covariate_hat <- covsearch(problem, cred_calc = TRUE, M = 1000)
if (length(covariate_hat$witness) > 1) {
sol_ACE <- bindagCausalEffectBackdoor(problem, prior_table = 10, S = covariate_hat$Z[[1]])
cat(sprintf("Estimated ACE = %1.2f\n", sol_ACE))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.