Learn R Programming

fetwfe (version 1.5.0)

getTes: Compute True Treatment Effects

Description

This function extracts the true treatment effects from a full coefficient vector as generated by genCoefs(). It calculates the overall average treatment effect on the treated (ATT) as the equal-weighted average of the cohort-specific treatment effects, and also returns the individual treatment effects for each treated cohort.

Usage

getTes(coefs_obj)

Value

A named list with two elements:

att_true

A numeric value representing the overall average treatment effect on the treated. It is computed as the (equal-weighted) mean of the cohort-specific treatment effects.

actual_cohort_tes

A numeric vector containing the true cohort-specific treatment effects, calculated by averaging the coefficients corresponding to the treatment dummies for each cohort.

Arguments

coefs_obj

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

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 the simple average of these cohort-specific effects.

Examples

Run this code
if (FALSE) {
# Generate coefficients
coefs <- genCoefs(R = 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)
}

Run the code above in your browser using DataLab