Skip to contents

This function extracts the true treatment effects from a full coefficient vector as generated by genCoefs(). It returns the per-cohort CATTs and an overall ATT. Under the default marginal cohort-assignment DGP, the overall ATT is the equal-weighted mean of the cohort-specific effects. Under the covariate-dependent DGPs introduced in 1.14.0, the overall ATT is a propensity-weighted mean using cohort weights \(E[\pi_g(X)] / \sum_{g' \text{ treated}} E[\pi_{g'}(X)]\), matching Faletto (2025) Eq. att.estimator.weighted (line 837) at the population level. The expected propensities are computed by Monte Carlo integration over the covariate distribution.

Usage

getTes(coefs_obj, distribution = "gaussian")

Arguments

coefs_obj

An object of class "FETWFE_coefs" containing the coefficient vector and simulation parameters.

distribution

Character; the covariate distribution to integrate the propensity-weighted truth over. Must match the distribution passed to simulateData for the panel whose truth you want. One of "gaussian" (default) or "uniform". Only affects covariate-dependent assignment (assignment_type != "marginal"); it is ignored under marginal assignment, where the cohort weights are uniform.

Value

An object of class "FETWFE_tes", which is a list with the following elements:

att_true

A numeric value representing the overall average treatment effect on the treated. Under the marginal DGP this is the equal-weighted mean of the cohort-specific effects; under covariate-dependent DGPs it is the propensity-weighted mean using cohort_weights.

actual_cohort_tes

A numeric vector of length G containing the true cohort-specific treatment effects, calculated by averaging the coefficients corresponding to the treatment dummies for each cohort. Intrinsic to \(\beta\); does not depend on the assignment DGP.

actual_event_time_tes

A named numeric vector of length T - 1 giving the true treatment effect at each event time (periods since adoption) e = 0, 1, ..., T - 2, with names "0", ..., "T-2". Each event time's effect is the mean of the true per-(g, t) cell effects over the cohorts still observed at that event time, weighted in proportion to cohort_weights — the same aggregation eventStudy() estimates on a fitted panel. NA at an event time no cohort reaches (where eventStudy() instead reports 0). New in 1.56.7.

cohort_times

An integer vector of length G giving the calendar time period at which each treated cohort first adopts treatment. In the simulator's convention cohort g adopts at calendar time g + 1 (cohort 0 is never-treated).

cohort_weights

Numeric vector of length G summing to 1. Under the marginal DGP this is uniform 1/G. Under assignment_type = "multinomial" or "ordered" it is \(E[\pi_g(X)] / \sum_{g' \text{ treated}} E[\pi_{g'}(X)]\). New in 1.14.0.

assignment_type

Character; the cohort-assignment DGP carried over from coefs_obj (one of "marginal", "multinomial", or "ordered"). Determines whether cohort_weights is uniform (marginal) or propensity-weighted. New in 1.18.1.

assignment_strength

Numeric; the assignment-strength scaling carried over from coefs_obj (meaningful only when assignment_type != "marginal"). NULL for FETWFE_coefs objects saved before 1.14.0. New in 1.18.1.

G, T, d, seed

The generating parameters carried over from coefs_obj so that print() and summary() on the returned object are self-describing.

R

Deprecated alias for G, retained for backward compatibility; populated with the same value. Use G. Will be removed in a future release.

Use print() or summary() on the returned object for a formatted display.

Details

The function internally uses auxiliary routines getNumTreats(), getP(), getFirstInds(), getTreatInds(), and getActualCohortTes() to determine the correct indices of treatment effect coefficients in beta. The overall treatment effect is computed as a weighted average of the cohort-specific effects (uniform weights under the marginal DGP, propensity weights otherwise).

Under non-marginal DGPs, \(E[\pi_g(X)]\) is estimated by Monte Carlo integration over the X distribution set by distribution ("gaussian" by default) with M = 10000 draws. The Monte Carlo seed is offset from the main coefs_obj$seed by + 2L per the documented seed-offset convention.

References

Faletto, G (2025). Fused Extended Two-Way Fixed Effects for Difference-in-Differences with Staggered Adoptions. arXiv preprint arXiv:2312.05985. https://arxiv.org/abs/2312.05985.

Examples

if (FALSE) { # \dontrun{
# Generate coefficients
coefs <- genCoefs(G = 5, T = 30, d = 12, density = 0.1, eff_size = 2, seed = 123)

# Compute the true treatment effects:
te_results <- getTes(coefs)

# Overall average treatment effect on the treated:
print(te_results$att_true)

# Cohort-specific treatment effects:
print(te_results$actual_cohort_tes)

# True effect at each event time (periods since adoption):
print(te_results$actual_event_time_tes)

# Or use the new print method for a self-describing display:
print(te_results)

# Propensity-weighted truth under covariate-dependent DGP:
coefs_mn <- genCoefs(G = 3, T = 5, d = 2, density = 0.5, eff_size = 2,
                    assignment_type = "multinomial", assignment_strength = 1.0,
                    seed = 42)
te_mn <- getTes(coefs_mn)
te_mn$att_true       # propensity-weighted overall ATT
te_mn$cohort_weights # length G; sums to 1
} # }