The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

ria.test

Lifecycle: experimental License: GPL v3

ria.test implements the empirical test introduced by Yu, Ge, and Elwert (2026) for detecting when randomized interventional analogues should not be interpreted as natural mediation effects. The test estimates TE - TE^R, the difference between the total effect and its randomized interventional analogue. Rejecting TE - TE^R = 0 falsifies the composite null that the natural indirect and direct effects equal their randomized interventional analogues. The procedure remains valid in settings where the natural effects themselves are not identified, and |TE - TE^R| provides a lower bound on the total divergence between the natural and randomized interventional decompositions.

The implementation uses Riesz-regression machinery adapted from the upstream mediation-estimation codebase for the total-effect contrast and associated uncertainty estimates.

ria.test is derived from the crumble package. Attribution identifies authorship of incorporated code and does not imply endorsement of this package or its modifications.

Installation

remotes::install_github("ang-yu/ria.test")

Usage

library(ria.test)

# `set.seed()` controls R-level randomness; `torch_seed` controls Torch.
set.seed(123)
n <- 500
w <- rnorm(n)
a <- rbinom(n, 1, plogis(w))
l <- rnorm(n, a + w)
m <- rnorm(n, a + l + w)
y <- rnorm(n, a + l + m + w)
dat <- data.frame(w, a, l, m, y)

test_fit <- ria.test(
  data = dat,
  trt = "a",
  outcome = "y",
  mediators = "m",
  pre = "w",
  post = "l",
  d0 = \(data, trt) rep(0, nrow(data)),
  d1 = \(data, trt) rep(1, nrow(data)),
  control = ria.test.control(torch_seed = 123L)
)

tidy(test_fit)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.