Learn R Programming

gfoRmulaICE (version 1.1.1)

threshold: Threshold

Description

This function specifies the threshold intervention on the treatment variable in data. If treatment value is between the lower bound and the upper bound, it follows the natural value of the treatment. If treatment value is either below the lower bound or above the upper bound, it is set to the lower bound or the upper bound, correspondingly. See Young et al. (2014) for more details.

Usage

threshold(lower_bound, upper_bound, var, data)

Value

a vector containing the intervened values of the same size as the number of rows in data.

Arguments

lower_bound

a number indicating the lower bound of the threshold.

upper_bound

a number indicating the upper bound of the threshold.

var

a string specifying the treatment variable for the intervention.

data

a data frame containing the observed data.

References

Young JG, Herńan MA, Robins JM. Identification, estimation and approximation of risk under interventions that depend on the natural value of treatment using observational data. Epidemiologic Methods. 2014;3(1):1-19.

Examples

Run this code
data <- gfoRmulaICE::compData
threshold_treat <- threshold(lower_bound = 0, upper_bound = 2, var = "A1", data = data)

Run the code above in your browser using DataLab