https://github.com/santikka/dosearch
dosearch: R Package for Identifying General Causal Queries
https://github.com/santikka/dosearch
c-plus-plus causal-inference causal-models causality causality-algorithms directed-acyclic-graph graphs labeled-graphs r
Last synced: about 2 months ago
JSON representation
dosearch: R Package for Identifying General Causal Queries
- Host: GitHub
- URL: https://github.com/santikka/dosearch
- Owner: santikka
- License: gpl-3.0
- Created: 2020-11-27T08:37:30.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-07-16T06:50:23.000Z (10 months ago)
- Last Synced: 2025-02-28T20:32:41.717Z (3 months ago)
- Topics: c-plus-plus, causal-inference, causal-models, causality, causality-algorithms, directed-acyclic-graph, graphs, labeled-graphs, r
- Language: R
- Homepage:
- Size: 2.61 MB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE.md
- Codemeta: codemeta.json
Awesome Lists containing this project
README
---
output: github_document
---```{r setup, include=FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
``````{r srr-tags, eval = FALSE, echo = FALSE}
#' @srrstats {G1.0} Primary reference is:
#' S. Tikka, A. Hyttinen and J. Karvanen.
#' "Causal effect identification from multiple incomplete data sources:
#' a general search-based approach." \emph{Journal of Statistical Software},
#' 99(5):1--40, 2021.
#' @srrstats {G1.1} First implementation of an original algorithm.
#' @srrstats {G1.2} Life Cycle Statement is included in the README.
```# dosearch
[](https://www.repostatus.org/#active)
[](https://github.com/santikka/dosearch/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/santikka/dosearch?branch=master)
[](https://CRAN.R-project.org/package=dosearch)The `dosearch` [R](https://www.r-project.org/) package facilitates
identification of causal effects from arbitrary observational and experimental
probability distributions via do-calculus and standard probability
manipulations using a search-based algorithm (Tikka et al., 2019, 2021).
Formulas of identifiable target distributions are returned in character format
using LaTeX syntax. The causal graph may additionally include mechanisms
related to:* Selection bias (Bareinboim and Tian, 2015)
* Transportability (Bareinboim and Pearl, 2014)
* Missing data (Mohan et al., 2013)
* Context-specific independence (Corander et al., 2019)
See the package vignette or the references for further information.
### Citing the packageIf you use the `dosearch` package in a publication, please cite the
corresponding paper in the Journal of Statistical Software:Tikka S, Hyttinen A, Karvanen J (2021). “Causal Effect Identification from
Multiple Incomplete Data Sources: A General Search-Based Approach.”
*Journal of Statistical Software*, 99(5), 1--40.
[doi:10.18637/jss.v099.i05](https://doi.org/10.18637/jss.v099.i05).## Installation
You can install the latest release version from CRAN:
```{r, eval = FALSE}
install.packages("dosearch")
```Alternatively, you can install the latest development version of `dosearch`:
```{r, eval = FALSE}
# install.packages("devtools")
devtools::install_github("santikka/dosearch")
```## Examples
```{r, echo = FALSE}
library(dosearch)
``````{r, eval = TRUE}
# back-door formula
data <- "p(x,y,z)"
query <- "p(y|do(x))"
graph <- "
x -> y
z -> x
z -> y
"
dosearch(data, query, graph)# front-door formula
graph <- "
x -> z
z -> y
x <-> y
"
dosearch(data, query, graph)# the 'napkin' graph
data <- "p(x,y,z,w)"
graph <- "
x -> y
z -> x
w -> z
x <-> w
w <-> y
"
dosearch(data, query, graph)# case-control design
data <- "
p(x*,y*,r_x,r_y)
p(y)
"
graph <- "
x -> y
y -> r_y
r_y -> r_x
"
md <- "r_x : x, r_y : y"
dosearch(data, query, graph, missing_data = md)
```## References
* Tikka S, Hyttinen A, Karvanen J (2021).
"Causal effect identification from multiple incomplete data sources: a general search-based approach."
*Journal of Statistical Software*,
99(5), 1--40.
[doi:10.18637/jss.v099.i05](https://doi.org/10.18637/jss.v099.i05)
* Tikka S, Hyttinen A, Karvanen J (2019).
"Identifying causal effects via context-specific independence relations."
In *Proceedings of the 33rd Annual Conference on Neural Information Processing Systems*.
(https://papers.nips.cc/paper/2019/hash/d88518acbcc3d08d1f18da62f9bb26ec-Abstract.html)
* Bareinboim E, Tian J (2015).
"Recovering causal effects from selection bias."
In *Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence*,
(http://ftp.cs.ucla.edu/pub/stat_ser/r445.pdf)
* Bareinboim E, Pearl J (2014).
"Transportability from multiple environments with limited Experiments: completeness Results."
In *Advances of Neural Information Processing Systems 27*,
(http://ftp.cs.ucla.edu/pub/stat_ser/r443.pdf)
* Mohan K, Pearl J, Tian J (2013).
"Graphical models for inference with missing data."
In *Advances of Neural Information Processing Systems 26*,
(http://ftp.cs.ucla.edu/pub/stat_ser/r410.pdf)
* Corander J, Hyttinen A, Kontinen J, Pensar J, Väänänen J (2019).
"A logical approach to context-specific independence."
*Annals of Pure and Applied Logic*,
170(9), 975--992.
[doi:10.1016/j.apal.2019.04.004](https://doi.org/10.1016/j.apal.2019.04.004)