Package: fetwfe 1.55.0

fetwfe: Fused Extended Two-Way Fixed Effects

Calculates the fused extended two-way fixed effects (FETWFE) estimator for unbiased and efficient estimation of difference-in-differences in panel data with staggered treatment adoption. This estimator eliminates bias inherent in conventional two-way fixed effects estimators, while also employing a novel bridge regression regularization approach to improve efficiency and yield valid standard errors. Also implements extended TWFE (etwfe) and bridge-penalized ETWFE (betwfe). Provides S3 classes for streamlined workflow and supports flexible tuning (ridge and rank-condition guarantees), automatic covariate centering/scaling, and detailed overall and cohort-specific effect estimates with valid standard errors. Includes simulation and formatting utilities, extensive diagnostic tools, vignettes, and examples. See Faletto (2025) (<doi:10.48550/arXiv.2312.05985>).

Authors:Gregory Faletto [aut, cre]

fetwfe_1.55.0.tar.gz
fetwfe_1.55.0.zip(r-4.7)fetwfe_1.55.0.zip(r-4.6)fetwfe_1.55.0.zip(r-4.5)
fetwfe_1.55.0.tgz(r-4.6-any)fetwfe_1.55.0.tgz(r-4.5-any)
fetwfe_1.55.0.tar.gz(r-4.7-any)fetwfe_1.55.0.tar.gz(r-4.6-any)
fetwfe_1.55.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
fetwfe/json (API)

# Install 'fetwfe' in R:
install.packages('fetwfe', repos = c('https://gregfaletto.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/gregfaletto/fetwfepackage/issues

On CRAN:

Conda:

7.01 score 5 stars 81 scripts 435 downloads 21 exports 13 dependencies

Last updated from:d5d50a4b35. Checks:2 ERROR, 7 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64ERROR608
source / vignettesOK243
linux-release-x86_64ERROR619
macos-release-arm64OK441
macos-oldrel-arm64OK518
windows-develOK621
windows-releaseOK598
windows-oldrelOK621
wasm-releaseOK180

Exports:attgtToFetwfeDfbetwfebetwfeWithSimulatedDatacohortStudycohortTimeATTsdebiasedATTdebiasedATTWithSimulatedDataetwfeetwfeToFetwfeDfetwfeWithSimulatedDataeventStudyfetwfefetwfeWithSimulatedDatagenCoefsgenCoefsCoregetTessimulateDatasimulateDataCoresimultaneousCIstwfeCovstwfeCovsWithSimulatedData

Dependencies:codetoolsforeachgenericsglmnetgrpregiteratorslatticeMatrixmvtnormRcppRcppEigenshapesurvival

Inference in fetwfe: standard errors, simultaneous bands, and high-dimensional debiasing
1. The headline: tight Gaussian CIs by default under (Ψ-IF) | 1.1 Which propensity-score estimators satisfy (Ψ-IF)? | 1.2 What changed in v1.12.0 | 2. The two variance pieces and how the package exposes them | 2.1 $V_1$: regression-coefficient variance | 2.2 $V_2$: propensity-score variance | 2.3 The combined variance: tilde_v_N and the paper's catalogue | 3. The conservative fallback: se_type = "conservative" | 4. Experimental: cluster-robust standard errors via se_type = "cluster" | 4.1 The formula | 4.2 Why we call this experimental | 4.3 Worked cluster comparison | 5. Choosing the bridge penalty parameter lambda | 6. Simultaneous confidence intervals via simultaneousCIs() | The multiplier-bootstrap method: method = "bootstrap" | Simultaneous bands are the default: the ci_type argument | 7. Selection consistency as an implicit zero-effect test | Why this is stronger than a confidence interval on an unregularized estimator | The q < 1 caveat | A controlled-truth worked example | Scope: this is the post-treatment zero-effect test | 8. High-dimensional inference ($p \geq NT$): debiasedATT() | A worked example | Why debiased, and how well it covers | Few clusters: the wild cluster bootstrap | Simultaneous bands at $p \geq NT$ | Controlled high-dimensional truth | References

Last update: 2026-07-02
Started: 2026-05-12

Simulation Vignette for FETWFE: From Coefficients to True Treatment Effects
Introduction | Simulation Workflow Using Piping | Step 1: Generate Simulation Coefficients | Step 2: Simulate Panel Data | Step 3: Run the FETWFE Estimator on Simulated Data | Step 4: Extract True Treatment Effects | Combining the Workflow in One Pipeline | Covariate-dependent cohort assignment | Multinomial-logit DGP | Ordered-logit DGP | Effect of assignment strength | Nonlinear propensity via interactions | Truth derivation under non-marginal DGPs | Targeted-sparsity coefficients for high-dimensional DGPs | Conclusion

Last update: 2026-06-29
Started: 2025-03-05

fetwfe: A Package for Fused Extended Two-Way Fixed Effects
Introduction | Background | Package Usage | Simulated Data Example | A "Real Data" Example | Testing the zero-effect null | Per-cohort, per-event-time, and per-(cohort, time) accessors | Tidy outputs with broom | Conclusion | References

Last update: 2026-06-08
Started: 2025-02-07

Choosing a fusion structure: cohort vs. event-study penalties
What a "fusion structure" is | fusion_structure = "cohort" (the default) | fusion_structure = "event_study" | Two meanings of "event study" --- read this first | A side-by-side demo | When to prefer each | Supplying your own fusion matrix D_N (advanced) | The row/column ordering | Worked example | Staying inside the theoretical guarantees | References

Last update: 2026-06-07
Started: 2026-06-04

Comparison Estimators: ETWFE and BETWFE
Introduction | Setup: simulating panel data | etwfe(): extended TWFE without penalty | betwfe(): bridge-penalized ETWFE | No-covariate setting | Visualizing event-time effects | When to use which | References

Last update: 2026-06-06
Started: 2026-05-11

Readme and manuals

Help Manual

Help pageTopics
Single-bracket access on a 'catt_df' object[.catt_df
Double-bracket access on a 'catt_df' object[[.catt_df
Double-bracket assignment on a 'catt_df' object[[<-.catt_df
Single-bracket assignment on a 'catt_df' object[<-.catt_df
Dollar-sign access on a 'catt_df' object$.catt_df
Dollar-sign assignment on a 'catt_df' object$<-.catt_df
Convert data formatted for 'att_gt()' to a dataframe suitable for 'fetwfe()' / 'etwfe()'attgtToFetwfeDf
Augment user-supplied data with fitted values and residuals from a betwfe fitaugment.betwfe
Augment user-supplied data with fitted values and residuals from an etwfe fitaugment.etwfe
Augment user-supplied data with fitted values and residuals from a fetwfe fitaugment.fetwfe
Augment is not defined for a twfeCovs fit (documented omission)augment.twfeCovs
Bridge-penalized extended two-way fixed effectsbetwfe
Bridge-Penalized Extended Two-Way Fixed Effects Output Classbetwfe-class
Run BETWFE on Simulated DatabetwfeWithSimulatedData
Per-cohort average treatment effectscohortStudy
Per-(cohort, time) average treatment effectscohortTimeATTs
Debiased overall-ATT with a uniformly-valid standard errordebiasedATT
Run debiasedATT() on simulated datadebiasedATTWithSimulatedData
Extended two-way fixed effectsetwfe
Extended Two-Way Fixed Effects Output Classetwfe-class
Convert data prepared for 'etwfe::etwfe()' to the format required by 'fetwfe()' and 'fetwfe::etwfe()'etwfeToFetwfeDf
Run ETWFE on Simulated DataetwfeWithSimulatedData
Compute pooled event-time treatment-effect estimateseventStudy
Fused extended two-way fixed effectsfetwfe
FETWFE Coefficient-Vector ClassFETWFE_coefs-class
Simulated Panel-Data ClassFETWFE_simulated-class
Compute True Treatment Effects Output ClassFETWFE_tes-class
Fused Extended Two-Way Fixed Effects Output Classfetwfe-class
Run FETWFE on Simulated DatafetwfeWithSimulatedData
Generate Coefficient Vector for Data GenerationgenCoefs
Generate Coefficient Vector for Data Generation (core)genCoefsCore
Compute True Treatment EffectsgetTes
Glance a 'betwfe' fitted objectglance.betwfe
Glance an 'etwfe' fitted objectglance.etwfe
Glance an 'fetwfe' fitted objectglance.fetwfe
Glance a 'twfeCovs' fitted objectglance.twfeCovs
Plot CATT or event-study estimates from a fitted BETWFEplot.betwfe
Plot CATT or event-study estimates from a fitted ETWFEplot.etwfe
Plot CATT or event-study estimates from a fitted FETWFE / ETWFE / BETWFEplot.fetwfe
Plot a simultaneous-confidence-interval objectplot.simultaneous_cis
Plot is not defined for a twfeCovs fit (documented omission)plot.twfeCovs
Print a debiased overall-ATT estimateprint.debiased_att
Print a simultaneous-confidence-interval objectprint.simultaneous_cis
Generate Random Panel Data for FETWFE SimulationssimulateData
Generate Random Panel Data for FETWFE Simulations (core)simulateDataCore
Parametric simultaneous (1 - alpha) confidence intervals over a family of treatment effectssimultaneousCIs
Tidy a 'betwfe' fitted objecttidy.betwfe
Tidy a 'cohortStudy' objecttidy.cohortStudy
Tidy a 'cohortTimeATTs' objecttidy.cohortTimeATTs
Tidy a debiased overall-ATT estimatetidy.debiased_att
Tidy an 'etwfe' fitted objecttidy.etwfe
Tidy an 'eventStudy' objecttidy.eventStudy
Tidy an 'fetwfe' fitted objecttidy.fetwfe
Tidy a 'FETWFE_tes' simulation truth objecttidy.FETWFE_tes
Tidy a simultaneous-confidence-interval objecttidy.simultaneous_cis
Tidy a 'twfeCovs' fitted objecttidy.twfeCovs
Two-way fixed effects with covariates and a single pooled treatment effect per cohorttwfeCovs
TWFE-With-Covariates Output ClasstwfeCovs-class
Run twfeCovs on Simulated DatatwfeCovsWithSimulatedData