https://integrated-inferences.github.io/CausalQueries/
CausalQueries
is a package that lets you declare binary causal models, update beliefs about causal types given data and calculate arbitrary estimands. Model definition makes use of dagitty
functionality. Updating is implemented in stan
.
See vignettes for a guide to getting started.
See here for a guide to using CausalQueries
along with many examples of causal models
To install the latest stable release of CausalQueries
:
install.packages("CausalQueries")
To install the latest development release :
install.packages("devtools")
devtools::install_github("integrated-inferences/CausalQueries")
Causal models are defined by:
A
to B
then a change in A
never induces a change in B
.X=1
and for which Y=1
if and only if X=1
. The set of causal types grows rapidly with the number of nodes and the number of nodes pointing into any given node. In this setting imposing functional forms is the same as placing restrictions on causal types: such restrictions reduce complexity but require substantive assumptions. An example of a restriction might be “Y
is monotonic in X
.”set_priors
function and many examples can be seen by typing ? set_priors.R
.A wrinkle:
Our goal is to form beliefs over parameters but also over more substantive estimands:
With a causal model in hand and data available about some or all of the nodes, it is possible to make use of a generic stan
model that generates posteriors over the parameter vector.
Given updated (or prior) beliefs about parameters it is possible to calculate causal estimands of inference from a causal model. For example “What is the probability that X
was the cause of Y
given X=1
, Y=1
and Z=1
.”
The approach used in CausalQueries
is a generalization of the biqq
models described in “Mixing Methods: A Bayesian Approach” (Humphreys and Jacobs, 2015). The conceptual extension makes use of work on probabilistic causal models described in Pearl’s Causality (Pearl, 2009). The approach to generating a generic stan
function that can take data from arbitrary models was developed in key contributions by Jasper Cooper and Georgiy Syunyaev. Lily Medina did the magical work of pulling it all together and developing approaches to characterizing confounding and defining estimands. Julio Solis has done wonders to simplify the specification of priors.