| Title: | Bidirectional Two-Stage Least Squares Estimation |
|---|---|
| Description: | Implements bidirectional two-stage least squares (Bi-TSLS) estimation for identifying bidirectional causal effects between two variables in the presence of unmeasured confounding. The method uses proxy variables (negative control exposure and outcome) along with at least one covariate to handle confounding. |
| Authors: | Jiaqi Min [aut, cre] |
| Maintainer: | Jiaqi Min <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-05-24 09:56:02 UTC |
| Source: | https://github.com/jiaqi-min/bitsls |
Performs bidirectional two-stage least squares (Bi-TSLS) estimation to identify bidirectional causal effects between X and Y using proxy variables Z and W. Requires at least one covariate in addition to X, Y, Z, and W.
Bi_TSLS(data, R_w = 0, R_z = 0)Bi_TSLS(data, R_w = 0, R_z = 0)
data |
A data frame containing at least these variables:
|
R_w |
Sensitivity parameter for W (default = 0) |
R_z |
Sensitivity parameter for Z (default = 0) |
A list containing:
beta_XY: Estimated effect of X on Y
beta_YX: Estimated effect of Y on X
# Create example data with covariate n <- 1000 data <- data.frame( X = rnorm(n), Y = rnorm(n), Z = rnorm(n), W = rnorm(n), V = rnorm(n) # At least one covariate is required ) # Run BiTSLS result <- Bi_TSLS(data) print(result)# Create example data with covariate n <- 1000 data <- data.frame( X = rnorm(n), Y = rnorm(n), Z = rnorm(n), W = rnorm(n), V = rnorm(n) # At least one covariate is required ) # Run BiTSLS result <- Bi_TSLS(data) print(result)