Package 'BiTSLS'

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

Help Index


Bidirectional Two-Stage Least Squares Estimation

Description

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.

Usage

Bi_TSLS(data, R_w = 0, R_z = 0)

Arguments

data

A data frame containing at least these variables:

  • X: Treatment/exposure variable

  • Y: Outcome variable

  • Z: Negative control exposure (proxy variable)

  • W: Negative control outcome (proxy variable)

  • At least one additional covariate (required)

R_w

Sensitivity parameter for W (default = 0)

R_z

Sensitivity parameter for Z (default = 0)

Value

A list containing:

  • beta_XY: Estimated effect of X on Y

  • beta_YX: Estimated effect of Y on X

Examples

# 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)