A simple R package for estimating bidirectional causal effects using proxy variables.
# Install from GitHub
# install.packages("devtools")
::install_github("Fhoneysuckle/BiTSLS") devtools
The Bi_TSLS()
function estimates bidirectional causal
effects between X and Y:
library(BiTSLS)
# Prepare your data with required variables
<- data.frame(
data X = ..., # Treatment variable
Y = ..., # Outcome variable
Z = ..., # Negative control exposure
W = ..., # Negative control outcome
# Additional covariates (At least one covariate)
)
# Run the estimation
<- Bi_TSLS(data)
result
# View results
print(result) # Effect of X on Y and Y on X
Your 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
<- Bi_TSLS(data, R_w = 0.1, R_z = -0.1) result
MIT License