Skip to content

cfid

Identification of Counterfactual Queries in Causal Models

v0.1.8 · Oct 27, 2025 · GPL (>= 3)

Description

Facilitates the identification of counterfactual queries in structural causal models via the ID* and IDC* algorithms by Shpitser, I. and Pearl, J. (2007, 2008) <doi:10.48550/arXiv.1206.5294>, <https://jmlr.org/papers/v9/shpitser08a.html>. Provides a simple interface for defining causal diagrams and counterfactual conjunctions. Construction of parallel worlds graphs and counterfactual graphs is carried out automatically based on the counterfactual query and the causal diagram. See Tikka, S. (2023) <doi:10.32614/RJ-2023-053> for a tutorial of the package.

Downloads

CRAN

309

Last 30 days

14882nd

798

Last 90 days

3.6K

Last year

Trend: +40.5% (30d vs prior 30d)

r2u CRAN

1

Last 30 days

28

Last 90 days

176

Last year

Trend: -91.7% (30d vs prior 30d)

autoCRAN

3

Last 7 days

7

Last 30 days

1

All-time

autoCRAN-only: this name is served only by autoCRAN, so the count is exact.

CRAN Check Status

13 OK
Show all 13 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang OK
r-devel-linux-x86_64-debian-gcc OK
r-devel-linux-x86_64-fedora-clang OK
r-devel-linux-x86_64-fedora-gcc OK
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 OK
r-oldrel-macos-x86_64 OK
r-oldrel-windows-x86_64 OK
r-patched-linux-x86_64 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK

Check History

OK 14 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 10, 2026

Code

Structure

Lines of code

4,703

Files

32

Compiled share

0%

Has compiled src

No

Language breakdown

R 3,121 (66.4%)Tests 843 (17.9%)Docs 739 (15.7%)

API

Exported functions

11

Internal functions

74

Recent export changes

v0.1.4+5 causal_effect, counterfactual_conjunction, counterfactual_variable +2 more  −3 CounterfactualConjunction, CounterfactualVariable, Probability
v0.1.2+9 CounterfactualConjunction, CounterfactualVariable, Probability +6 more

Testing & CI

Has tests

Yes

Test-to-code ratio

0.27

testthat edition

3

CI present

No

CI type

[]

PR gated

No

Docs

Return-value doc rate

100%

\dontrun example ratio

0%

Roxygen coverage

100%

Has pkgdown

No

NEWS present

Yes

Health & Security signals

Informational signals; not verdicts.

on.exit coverage

Unsafe pattern score

0

Dep constraint coverage

Secret pattern count

0

Bundled 3rd-party code

2 items

Portability & License

Min R version

System requirements

C++ standard

License

GPL (>= 3)

License flags

SPDX valid, OSI approved

History

Versions

5

First release

2021-06-10

Latest release

2025-10-27

Avg cadence

443 days

Cold removal rate

100%

Dep drift

0

LOC over versions

v0.1.2: 2,669 LOCv0.1.4: 4,477 LOCv0.1.6: 4,668 LOCv0.1.7: 4,671 LOCv0.1.8: 4,703 LOC

Per-file churn detail lives in the source pipeline: https://github.com/r-observatory/cran-code-metrics.

Reverse Dependencies (1)

imports

Dependency Network

Dependencies Reverse dependencies R6causal cfid

Version History

6 tracked
new 0.1.8 Mar 10, 2026
updated 0.1.8 ← 0.1.7 diff Oct 26, 2025
updated 0.1.7 ← 0.1.6 diff Nov 26, 2023
updated 0.1.6 ← 0.1.4 diff Nov 12, 2023
updated 0.1.4 ← 0.1.2 diff Oct 25, 2022
new 0.1.2 Jun 9, 2021