A simple R package for estimating bidirectional causal effects using proxy variables.
# Install from GitHub
# install.packages("devtools")
devtools::install_github("Fhoneysuckle/BiTSLS")The Bi_TSLS() function estimates bidirectional causal
effects between X and Y:
library(BiTSLS)
# Prepare your data with required variables
data <- data.frame(
  X = ...,  # Treatment variable
  Y = ...,  # Outcome variable
  Z = ...,  # Negative control exposure
  W = ...,  # Negative control outcome
  # Additional covariates (At least one covariate)
)
# Run the estimation
result <- Bi_TSLS(data)
# View results
print(result)  # Effect of X on Y and Y on XYour data must contain: - X: Treatment/exposure variable
(numeric) - Y: Outcome variable (numeric) - Z:
Negative control exposure (numeric) - W: Negative control
outcome (numeric) - Additional covariates are optional (At least one
covariate)
You can test sensitivity to violations of the proxy structural conditions:
# With sensitivity parameters
result <- Bi_TSLS(data, R_w = 0.1, R_z = -0.1)MIT License