Learn R Programming

fect (version 2.0.5)

fect_sens: Sensitivity Analysis for fect Objects under Relative Magnitude and Smoothness Restrictions

Description

Conducts sensitivity analyses on fect model objects under relative magnitude (RM) and smoothness (C-LF) assumptions, producing robust confidence intervals and parameter sets.

Usage

fect_sens(
  fect.out,
  post.periods = NA,
  l_vec = NA,
  Mbarvec = seq(0, 1, by = 0.1),
  Mvec = seq(0, 0.25, 0.05),
  periodMbarvec = c(0, 0.5),
  periodMvec = c(0, 0.1),
  parallel = FALSE,
  cores = NULL
)

Value

An updated fect object including:

sensitivity.rm

Relative Magnitude (RM) sensitivity results for average and period-by-period ATT.

sensitivity.smooth

Smoothness (C-LF) sensitivity results for average and period-by-period ATT.

Arguments

fect.out

A fitted fect object.

post.periods

Vector of post-treatment periods for sensitivity analysis. Default uses all available post-treatment periods.

l_vec

Optional weighting vector for averaging ATT across post-treatment periods. Default weights by treated-unit counts.

Mbarvec

Values of Mbar for overall RM-based sensitivity analysis.

Mvec

Values of M for overall smoothness-based sensitivity analysis.

periodMbarvec

Values of Mbar for period-specific RM sensitivity analysis.

periodMvec

Values of M for period-specific smoothness sensitivity analysis.

parallel

Logical; if TRUE, uses parallel computation where supported. Default is FALSE.

cores

Optional integer; number of workers when parallel = TRUE.

Author

Rivka Lipkovitz

Details

This function:

  1. Extracts ATT estimates and variance-covariance matrices from fect.out.

  2. Constructs weighted averages across post-treatment periods.

  3. Computes robust confidence sets under RM and C-LF assumptions.

  4. Optionally computes robust bounds for each post-treatment period separately.

Robust sets are computed using functions from the HonestDiDFEct package.

Examples

Run this code
if (FALSE) {
out <- fect(Y ~ D, data = df, index = c("unit", "time"), method = "fe", se = TRUE)
out_sens <- fect_sens(
  fect.out = out,
  post.periods = c(1, 2, 3, 4),
  Mbarvec = seq(0, 1, by = 0.2),
  Mvec = c(0, 0.05, 0.1),
  periodMbarvec = c(0, 0.5),
  periodMvec = c(0, 0.1)
)
names(out_sens$sensitivity.rm)
names(out_sens$sensitivity.smooth)
}

Run the code above in your browser using DataLab