Learn R Programming

CausalFX (version 1.0.1)

synthetizeCausalEffect: Computes Average Causal Effects by Covariate Adjustment in Binary Models using a Given Causal Model

Description

Computes the average causal effect (ACE) of a given treatment variable $X$ on a given outcome $Y$ for the models generated by simulateWitnessModel. This assumes the synthetic models are small enough, as adjustment is done by brute force calculation.

Usage

synthetizeCausalEffect(problem)

Arguments

problem
a cfx problem instance for the ACE of a given treatment $X$ on a given outcome $Y$. This problem instance should have a fully specified causal model, including a graph and conditional probability tables. It must also be small enough so that the joint probability must have been pre-computed.

Value

A list containing three different types of estimand:
effect_real
the true ACE.
effect_naive
the result of a naive adjustment using all of the observed covariates.
effect_naive2
the result of a naive adjustment using no covariates.

Details

The algorithm implemented is a naive one. When creating the cfx object, field num_v_max must be large enough so that the joint distribution is computed in advance. Only for relatively small models (approximately 20 variables in total) this will be feasible.

Examples

Run this code
## 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))

Run the code above in your browser using DataLab