rdhte_contrast: RD Heterogeneous Treatment Effects: contrast-targeted...

View source: R/rdhte_contrast.R

rdhte_contrastR Documentation

RD Heterogeneous Treatment Effects: contrast-targeted bandwidth

Description

rdhte_contrast refits an rdhte model at the MSE-optimal bandwidth for a single user-chosen linear combination of the Estimate vector and returns the resulting point estimate, robust bias-corrected estimate, standard error, p-value, and confidence interval.

Usage

rdhte_contrast(model, contrast, refit = TRUE, level = 95, tol = 1e-10)

Arguments

model

A fitted model returned by rdhte.

contrast

Numeric vector with length equal to nrow(model$Estimate). The user-facing linear combination of Estimate rows whose MSE is optimized.

refit

Logical. TRUE refits the model at the contrast-targeted bandwidth. FALSE projects the existing fit and returns inference under the model's current bandwidth.

level

Confidence level in percentage form, in [1, 100).

tol

Tolerance below which the estimated contrast bias is treated as zero and the contrast-targeted bandwidth is declared undefined.

Details

Use rdhte_lincom instead when you want joint Wald inference on several linear restrictions at one bandwidth.

Value

A list with the conventional estimate, robust bias-corrected estimate, robust standard error, z-statistic, p-value, confidence interval, selected bandwidth, pilot bandwidth, contrast diagnostics, and (when refit = TRUE) the refitted rdhte object.

See Also

rdhte, rdhte_lincom

Examples

## Not run: 
set.seed(123)
n <- 1000
X <- runif(n, -1, 1)
W <- rbinom(n, 1, 0.5)
Y <- 3 + 2 * X + 1.5 * X^2 + 3 * W * (X >= 0) + rnorm(n)
m <- rdhte(y = Y, x = X, covs.hte = factor(W))
rdhte_contrast(m, contrast = c(-1, 1))

## End(Not run)

rdhte documentation built on May 27, 2026, 1:06 a.m.