Package: fect 2.4.5

Yiqing Xu

fect: Fixed Effects Counterfactual Estimators

Provides tools for estimating causal effects in panel data using counterfactual methods, as well as other modern DID estimators. It is designed for causal panel analysis with binary treatments under the parallel trends assumption. The package supports scenarios where treatments can switch on and off and allows for limited carryover effects. It includes several imputation estimators, such as Gsynth (Xu 2017), linear factor models, and the matrix completion method. Detailed methodology is described in Liu, Wang, and Xu (2024) <doi:10.48550/arXiv.2107.00856> and Chiu et al. (2025) <doi:10.48550/arXiv.2309.15983>. Optionally integrates with the "HonestDiDFEct" package for sensitivity analyses compatible with imputation estimators. "HonestDiDFEct" is not on CRAN but can be obtained from <https://github.com/lzy318/HonestDiDFEct>.

Authors:Yiqing Xu [aut, cre], Licheng Liu [aut], Ziyi Liu [aut], Ye Wang [aut], Tianzhu Qin [aut], Shiyun Hu [aut], Rivka Lipkovitz [aut]

fect_2.4.5.tar.gz
fect_2.4.5.tar.gz(r-4.7-arm64)fect_2.4.5.tar.gz(r-4.7-x86_64)fect_2.4.5.tar.gz(r-4.6-arm64)fect_2.4.5.tar.gz(r-4.6-x86_64)
fect_2.4.5.tgz(r-4.6-emscripten)
manual.pdf |manual.html
card.svg |card.png
fect/json (API)

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

Bug tracker:https://github.com/xuyiqing/fect/issues

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3
Datasets:
  • gs2020 - Simulated Gsynth-like Panel Data
  • hh2019 - Simulated Panel Data Example
  • sim_base - Simulated data
  • sim_gsynth - Simulated data for Gsynth
  • sim_linear - Simulated panel data with unit-specific linear time trends
  • sim_region - Simulated unbalanced panel with region-specific time effects
  • sim_trend - Simulated panel data with unit-specific sinusoidal time trends
  • simdata - Simulated panel data with two latent factors
  • simgsynth - Simulated data for Gsynth
  • turnout - EDR and Voter Turnout in the US

On CRAN:

Conda:

openblascpp

3.79 score 1 packages 137 scripts 3.0k downloads 14 exports 67 dependencies

Last updated from:bbc71a2de6. Checks:6 OK. Indexed: no.

TargetResultTimeFilesSyslog
linux-devel-arm64OK325
linux-devel-x86_64OK312
source / vignettesOK314
linux-release-arm64OK322
linux-release-x86_64OK387
wasm-releaseOK213

Exports:att.cumudid_wrappereffectesplotestimandfectfect_idenfect_mspefect_sensget.cohortimputed_outcomesinterFEplot.fectr.cv.rolling

Dependencies:abindclicodetoolscpp11crayondigestdoFuturedoParalleldoRNGdplyrdreamerrfarverfixestforcatsforeachFormulafuturefuture.applygenericsGGallyggplot2ggstatsglobalsgluegridExtragtablehmsisobanditeratorslabelinglatticelifecyclelistenvmagrittrMASSmvtnormnlmenumDerivparallellypatchworkpillarpkgconfigplyrprettyunitsprogresspurrrR6RColorBrewerRcppRcppArmadilloreshape2rlangrngtoolsS7sandwichscalesstringistringmagicstringrtibbletidyrtidyselectutf8vctrsviridisLitewithrzoo

Readme and manuals

Help Manual

Help pageTopics
Fixed Effects Counterfactual Estimatorsfect-package
Calculate Cumulative Treatment Effectsatt.cumu
A Multi-Method Difference-in-Differences Estimatordid_wrapper
Calculate Cumulative or Sub-group Treatment Effectseffect
Event Study Visualizationesplot
Post-hoc Estimand Dispatcherestimand
Fixed Effects Counterfactual Estimatorsfect
Over-identification test for causal moderation (cm)fect_iden
Mean Squared Prediction Error Evaluation for fect Objectsfect_mspe
Sensitivity Analysis for fect Objects under Relative Magnitude and Smoothness Restrictionsfect_sens
Internal FEct Functionsbeta_iter beta_iter_ub cv.sample data_ub_adj equiv_test fect.default fect.formula fect_fe fect_mc fe_add fe_add2 fe_ad_covar_iter fe_ad_inter_covar_iter fe_ad_inter_iter fe_ad_iter interFE.default interFE.formula inter_fe inter_fe_mc inter_fe_ub panel_beta panel_est panel_factor panel_factor_ub panel_fe panel_fe_ub XXinv Y_demean _gsynth_beta_iter _gsynth_beta_iter_ub _gsynth_data_ub_adj _gsynth_fe_add _gsynth_fe_add2 _gsynth_fe_ad_covar_iter _gsynth_fe_ad_inter_covar_iter _gsynth_fe_ad_inter_iter _gsynth_fe_ad_iter _gsynth_inter_fe _gsynth_inter_fe_mc _gsynth_inter_fe_ub _gsynth_panel_beta _gsynth_panel_est _gsynth_panel_factor _gsynth_panel_factor_ub _gsynth_panel_fe _gsynth_panel_fe_ub _gsynth_XXinv _gsynth_Y_demean
Obatin the Cohort Indexget.cohort
Simulated Gsynth-like Panel Data (No Reversal)gs2020
Simulated Panel Data Examplehh2019
Imputed Potential Outcomes Accessorimputed_outcomes
Interactive Fixed Effects ModelsinterFE
Plot Method for 'fect' Objectsplot.fect
Print Resultsprint.fect
Print Resultsprint.interFE
Rolling-window cross-validation for rank selectionr.cv.rolling
Simulated data (no interactive fixed effects)sim_base
Simulated data for Gsynth (no treatment reversal)sim_gsynth
Simulated panel data with unit-specific linear time trends (block DID)sim_linear
Simulated unbalanced panel with region-specific time effectssim_region
Simulated panel data with unit-specific sinusoidal time trends (block DID)sim_trend
Simulated panel data with two latent factorssimdata
Simulated data for Gsynthsimgsynth
EDR and Voter Turnout in the USturnout