Learn R Programming

causens

Why is it that more shark attacks occur when more ice cream is sold? The answer: both are related to the weather, here an unmeasured confounder.

Overview

{causens} is an R package that will allow to perform various sensitivity analysis methods to adjust for unmeasured confounding within the context of causal inference. Currently, we provide the following methods:

Installation

install.packages("devtools")
library(devtools)
devtools::install_github("Kuan-Liu-Lab/causens")
library(causens)

Quickstart

library(causens)

# Simulate data
data <- simulate_data(N = 10000, seed = 123, alpha_uz = 1,
                      beta_uy = 1, treatment_effects = 1)

# Treatment model is incorrect since U is "missing"
causens_sf(Z ~ X.1 + X.2 + X.3, "Y", data = data, c1 = 0.25, c0 = 0.25)$estimated_ate

Citing

Please cite our software using:

@Manual{,
  title = {causens: Perform Causal Sensitivity Analyses Using Various Statistical Methods},
  author = {Larry Dong and Yushu Zou and Kuan Liu},
  year = {2024},
  note = {R package version 0.0.3, https://github.com/Kuan-Liu-Lab/causens},
  url = {https://kuan-liu-lab.github.io/causens/},
}

Getting help or contributing

Please report bugs by opening an issue. If you have a question regarding the usage of causens, please open a discussion. If you would like to contribute to the package, please open a pull request.

Copy Link

Version

Install

install.packages('causens')

Monthly Downloads

132

Version

0.0.3

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Larry Dong

Last Published

June 5th, 2025

Functions in causens (0.0.3)

summary.bayesian_causens

Summarize the results of a causal sensitivity analysis via Bayesian modelling of an unmeasured confounder.
summary.causens_sf

Summarize the results of a causal sensitivity analysis via sensitivity function.
create_jags_model

Create an JAGS model for Bayesian sensitivity analysis
bayesian_causens

Bayesian parametric sensitivity analysis for causal inference
causens_monte_carlo

Monte Carlo sensitivity analysis for causal effects
gData_U_cont_Y_binary

Generate data with a continuous unmeasured confounder and a binary outcome
gData_U_binary_Y_binary

Generate data with a binary unmeasured confounder and binary outcome
plot_causens

Plot ATE with respect to sensitivity function value when it is constant, i.e. c(1, e) = c1 and c(0, e) = c0.
process_model_formula

Process model formula
gData_U_binary_Y_cont

Generate data with a binary unmeasured confounder and continuous outcome
causens_sf

Bayesian Estimation of ATE Subject to Unmeasured Confounding
gData_U_cont_Y_cont

Generate data with a continuous unmeasured confounder and continuous outcome
summary.monte_carlo_causens

Summarize the results of a causal sensitivity analysis via the Monte Carlo method.
sf

Calculate sensitivity of treatment effect estimate to unmeasured confounding
simulate_data

Generate data with unmeasured confounder