Skip to content

WhatIf

Software for Evaluating Counterfactuals

v1.5-11 · Mar 25, 2026 · GPL (>= 3)

Description

Inferences about counterfactuals are essential for prediction, answering what if questions, and estimating causal effects. However, when the counterfactuals posed are too far from the data at hand, conclusions drawn from well-specified statistical analyses become based largely on speculation hidden in convenient modeling assumptions that few would be willing to defend. Unfortunately, standard statistical approaches assume the veracity of the model rather than revealing the degree of model-dependence, which makes this problem hard to detect. 'WhatIf' offers easy-to-apply methods to evaluate counterfactuals that do not require sensitivity testing over specified classes of models. If an analysis fails the tests offered here, then we know that substantive inferences will be sensitive to at least some modeling choices that are not based on empirical evidence, no matter what method of inference one chooses to use. 'WhatIf' implements the methods for evaluating counterfactuals discussed in Gary King and Langche Zeng, 2006, "The Dangers of Extreme Counterfactuals," Political Analysis 14 (2) <DOI:10.1093/pan/mpj004>; and Gary King and Langche Zeng, 2007, "When Can History Be Our Guide? The Pitfalls of Counterfactual Inference," International Studies Quarterly 51 (March) <DOI:10.1111/j.1468-2478.2007.00445.x>.

Downloads

248

Last 30 days

17961st

248

Last 90 days

285

Last year

CRAN Check Status

1 NOTE
13 OK
Show all 14 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-macos-arm64 OK
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 NOTE
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 details (1 non-OK)
NOTE r-oldrel-macos-arm64

package subdirectories

Problems with news in ‘NEWS.md’:
  Cannot extract version info from the following section titles:
    Major changes
    Minor changes

Check History

NOTE 9 OK · 1 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 27, 2026
NOTE r-oldrel-macos-arm64

package subdirectories

Problems with news in ‘NEWS.md’:
  Cannot extract version info from the following section titles:
    Major changes
    Minor changes
ERROR 5 OK · 2 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Mar 26, 2026
ERROR r-devel-macos-arm64

package subdirectories

Problems with news in ‘NEWS.md’:
  Cannot extract version info from the following section titles:
    Major changes
    Minor changes
NOTE r-release-macos-arm64

package subdirectories

Problems with news in ‘NEWS.md’:
  Cannot extract version info from the following section titles:
    Major changes
    Minor changes
NOTE r-oldrel-macos-arm64

package subdirectories

Problems with news in ‘NEWS.md’:
  Cannot extract version info from the following section titles:
    Major changes
    Minor changes

Dependency Network

Dependencies Reverse dependencies lpSolve pbmcapply WhatIf

Version History

new 1.5-11 Mar 25, 2026