Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test and document Santu Tikka's causaleffect R package #8

Open
wants to merge 42 commits into
base: master
Choose a base branch
from

Conversation

hmhummel
Copy link
Collaborator

@hmhummel hmhummel commented Aug 23, 2024

Completed documentation & testing for causal.effect functions

I documented 5 causaleffect functions, including simplify, join, insert, powerset, and parse.expression. causal.effect already had documentation from Tikka.

There are 25 total unit tests created using the testthat R package. 23/25 unit tests pass. I tested 6 functions per vignette (includes topo, which is undocumented because it's an igraph function)
There are 3 vignettes/test cases from causal.effect on CRAN: 1st with unobserved confounders, 2nd with pruning & fractions, and 3rd with simplest graph possible (no unobserved confounders). I created a unit test for each function per vignette: 7 unit tests for test_case_1, 9 unit tests for test_case_2, and 9 unit tests for test_case_3.

  • topo — 3/3 unit tests created; this is an igraph function so no documentation created; this is an igraph function with igraph::topo_sort(G) and get.vertex.attribute(G, "name")[topo]
  • simplify (Algorithm 1 in Tikka & Karvanen (2017)) — created working .Rd file & 3/3 unit tests
  • causal.effect - Tikka already has a .Rd file but might need clarification; created 3/3 unit tests
  • parse.expression — created working .Rd file & 3/3 unit tests

Needs work

  • join (Algorithm 2 in Tikka & Karvanen (2017)) — created working .Rd file & 2/3 unit tests. Does not pass for Vignette 2. Need to go back into test_case_2 and use causal.effect with expr = FALSE (try to plug result into ChatGPT) to remake P_2_pe1, P_2_pe2 (for parse.expression), P_2_s1, and P_2_s2 (for simplify) in order to successfully iterate through parse.expression and then simplify with breakpoints and obtain join inputs from print statements
  • insert (Algorithm 3 in Tikka & Karvanen (2017)) — created working .Rd file & 2/3 unit tests. Does not pass for Vignette 2 (^^ see above)
  • powerset — created working .Rd file; still needs examples & unit tests
  • get.expression — Tikka already has a .Rd file but might need clarification
  • deconstruct
  • dSep
  • wrap.dSep
  • factorize
  • probability
  • etc.

hmhummel and others added 30 commits July 11, 2024 16:40
This file contains all 3 test cases compiled into 1 file.
…n unit test with causal.effect simp = TRUE
delete previously-created simplify .Rd documentation in order to ensure no conflict with roxygen-created simplify (cannot modify .Rd files by hand; must use roxygen)
…d Encoding = UTF-8. Updated NAMESPACE file to include export(simplify). Updated simplify.R to include working documentation when ?simplify is run.
…simplify.Rd documentation. Added export(join) to NAMESPACE.
…ion documentation files with the test example.
@hmhummel hmhummel requested a review from djinnome August 23, 2024 21:03
@hmhummel hmhummel self-assigned this Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants