Package: causaloptim 1.0.0

causaloptim: An Interface to Specify Causal Graphs and Compute Bounds on Causal Effects

When causal quantities are not identifiable from the observed data, it still may be possible to bound these quantities using the observed data. We outline a class of problems for which the derivation of tight bounds is always a linear programming problem and can therefore, at least theoretically, be solved using a symbolic linear optimizer. We extend and generalize the approach of Balke and Pearl (1994) <doi:10.1016/B978-1-55860-332-5.50011-0> and we provide a user friendly graphical interface for setting up such problems via directed acyclic graphs (DAG), which only allow for problems within this class to be depicted. The user can then define linear constraints to further refine their assumptions to meet their specific problem, and then specify a causal query using a text interface. The program converts this user defined DAG, query, and constraints, and returns tight bounds. The bounds can be converted to R functions to evaluate them for specific datasets, and to latex code for publication. The methods and proofs of tightness and validity of the bounds are described in a paper by Sachs, Jonzon, Gabriel, and Sjölander (2022) <doi:10.1080/10618600.2022.2071905>.

Authors:Michael C Sachs [aut, cre], Erin E Gabriel [aut], Arvid Sjölander [aut], Gustav Jonzon [aut], Alexander A Balke [ctb]

causaloptim_1.0.0.tar.gz
causaloptim_1.0.0.zip(r-4.5)causaloptim_1.0.0.zip(r-4.4)causaloptim_1.0.0.zip(r-4.3)
causaloptim_1.0.0.tgz(r-4.4-any)causaloptim_1.0.0.tgz(r-4.3-any)
causaloptim_1.0.0.tar.gz(r-4.5-noble)causaloptim_1.0.0.tar.gz(r-4.4-noble)
causaloptim_1.0.0.tgz(r-4.4-emscripten)causaloptim_1.0.0.tgz(r-4.3-emscripten)
causaloptim.pdf |causaloptim.html
causaloptim/json (API)
NEWS

# Install 'causaloptim' in R:
install.packages('causaloptim', repos = c('https://sachsmc.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/sachsmc/causaloptim/issues

On CRAN:

6.64 score 15 stars 24 scripts 578 downloads 29 exports 37 dependencies

Last updated 1 months agofrom:2d70d790af. Checks:OK: 7. Indexed: yes.

TargetResultDate
Doc / VignettesOKNov 14 2024
R-4.5-winOKNov 14 2024
R-4.5-linuxOKNov 14 2024
R-4.4-winOKNov 14 2024
R-4.4-macOKNov 14 2024
R-4.3-winOKNov 14 2024
R-4.3-macOKNov 14 2024

Exports:analyze_graphbtm_varcausalproblemcheckcheck_constraints_violatedcheck_linear_objectivecheck_parentsconstraintscheckcreate_causalmodelcreate_effect_vectorcreate_linearcausalproblemcreate_q_matrixcreate_response_functionfind_all_pathsget_default_effectgraphrescheckinitialize_graphinterpret_boundslatex_boundslist_to_pathoptimize_effect_2parse_constraintsparse_effectplot_graphresquerycheckrdirichletsample_distributionsimulate_boundsspecify_graphupdate_effect

Dependencies:base64encbslibcachemclicommonmarkcpp11crayondigestfastmapfontawesomefsgluehtmltoolshttpuvigraphjquerylibjsonlitelaterlatticelifecyclemagrittrMatrixmemoisemimepkgconfigpromisesR6rappdirsrcddRcpprlangsassshinysourcetoolsvctrswithrxtable

Code from examples in manuscript

Rendered fromexample-code.Rmdusingknitr::rmarkdownon Nov 14 2024.

Last update: 2024-08-30
Started: 2020-03-09

How to use the causaloptim Shiny app to analyze graphs

Rendered fromshinyapp.Rmdusingknitr::rmarkdownon Nov 14 2024.

Last update: 2023-10-05
Started: 2019-08-15

Improving the speed of computing causal bounds

Rendered fromvertexenum-speed.Rmdusingknitr::rmarkdownon Nov 14 2024.

Last update: 2023-01-21
Started: 2021-01-20

Readme and manuals

Help Manual

Help pageTopics
An Interface to Specify Causal Graphs and Compute Bounds on Causal Effectscausaloptim-package causaloptim
Analyze the causal graph and effect to determine constraints and objectiveanalyze_graph
Recursive function to get the last name in a listbtm_var
Check conditions on causal problemcausalproblemcheck
Check whether any of the observable constraints implied by the causal model are violated for a given distribution of observablescheck_constraints_violated
Check linearity of objective function implied by a causal model and effectcheck_linear_objective
Check for paths from from to tocheck_parents
Check constraintsconstraintscheck
Create a structural causal model from a graph or a set of response functionscreate_causalmodel
Translate target effect to vector of response variablescreate_effect_vector
Create linear causal problem from causal model and effectcreate_linearcausalproblem
Translate response functions into matrix of counterfactualscreate_q_matrix
Translate regular DAG to response functionscreate_response_function
Find all paths in a causal modelfind_all_paths
Define default effect for a given graphget_default_effect
Check conditions on digraphgraphrescheck
Initialize an igraph object for use with causaloptiminitialize_graph
Convert bounds string to a functioninterpret_bounds
Latex bounds equationslatex_bounds
Recursive function to translate an effect list to a path sequencelist_to_path
Compute a bound on the average causal effectopt_effect
Run the optimizer to obtain symbolic boundsoptimize_effect optimize_effect_2
Parse text that defines a the constraintsparse_constraints
Parse text that defines a causal effectparse_effect
Plot the analyzed graph objectplot_graphres
Plot the graph from the causal problem with a legend describing attributesplot.linearcausalproblem
Print relevant information about the causal modelprint.causalmodel
Print the causal problemprint.linearcausalproblem
Check conditions on queryquerycheck
Sample from a Dirichlet distributionrdirichlet
Sample a distribution of observable probabilities that satisfy the causal modelsample_distribution
Simulate boundssimulate_bounds
Shiny interface to specify network structure and compute boundsspecify_graph
Update the effect in a linearcausalproblem objectupdate_effect