Clamp treatment within bounds

Description

Creates a modified treatment policy that clamps each individual’s observed treatment to lie within [lower, upper]. Values below lower are set to lower; values above upper are set to upper.

Usage

threshold(lower = -Inf, upper = Inf)

Arguments

lower Numeric. Lower bound (use -Inf for no lower bound).
upper Numeric. Upper bound (use Inf for no upper bound).

Value

A causatr_intervention object.

See Also

static(), shift(), scale_by(), dynamic(), ipsi()

Examples

library("causatr")

fit <- causat(nhefs, outcome = "wt82_71", treatment = "smokeintensity",
              confounders = ~ sex + age + wt71)
contrast(fit, interventions = list(
  capped20 = threshold(0, 20),
  observed  = shift(0)
))