13  Cheatsheet

In this chapter, we provide an overview of the main functionalities of the fect package, including the required inputs, available plot types, key options, and testing capabilities across various methods. It starts with a guide to choosing a method and a table of the option combinations that fect() changes or refuses.

13.1 Choosing a method

Every method in fect works in the same three steps. It fits a model of the untreated outcome \(Y(0)\) on the untreated cells, predicts \(Y(0)\) for the treated cells, and averages the differences between the observed outcomes and these predictions. The methods differ in two things only: the model for \(Y(0)\), and which untreated cells are used to fit it.

Data and concern Method Model for \(Y(0)\) and fitting sample
Many treated units; parallel trends are plausible once unit and time fixed effects and the covariates are accounted for "fe" (the default) Two-way fixed effects and the covariates. Fitted on all untreated cells, including those of treated units before treatment. Internally it is "ife" with r = 0.
The pre-treatment estimates show trends, which suggests unobserved confounders that change over time and affect units differently "ife" or "mc" "ife" adds r latent factors, each with unit-specific loadings. When r is not given, cross-validation chooses it from 0 to 5. "mc" shrinks the untreated outcome matrix toward a low-rank matrix (a nuclear-norm penalty lambda, chosen by cross-validation). Both use all untreated cells.
Few treated units (as few as one), treatment never switches off, and many never-treated units "gsynth" The "ife" model with the factors estimated from the never-treated units only (time.component.from = "nevertreated"). The treated units’ pre-treatment cells are then used only to estimate their own loadings and unit effects. Allows the parametric bootstrap (vartype = "parametric"), which Chapter 6 recommends when treated units are few.
The form of the confounding is known, such as shocks shared by a group in a period (for example region-by-year), time-invariant covariates whose effect changes over time, or unit-specific trends "cfe" Fixed effects plus the terms named in the call: extra fixed effects (index[3:] or group.fe), Z with gamma, Q or Q.type with kappa, and optional factors r. See Chapter 5.
Cross-validation should choose between IFE and MC "both", with CV = TRUE Cross-validates "ife" over r and "mc" over lambda, then fits the one with the lower error.

"ife" and "gsynth" fit the same model. The only difference is time.component.from: "ife" estimates the factors from all untreated cells ("notyettreated", the default), and "gsynth" from the never-treated units only. method = "ife" with time.component.from = "nevertreated" is the same fit as method = "gsynth", and the fit reports method = "gsynth".

A typical sequence:

  1. Fit "fe" with se = TRUE and look at the pre-treatment estimates: the gap plot, the F test and the equivalence test in fit$test.out, and a placebo test (placeboTest = TRUE with placebo.period). See Chapter 2.
  2. If the pre-treatment estimates move away from zero, fit "ife" and "mc" and repeat the checks. fect_mspe() compares the prediction errors of fitted models (Chapter 5).
  3. With few treated units and no treatment reversal, use "gsynth" with vartype = "parametric" or vartype = "conformal" (Chapter 8).
  4. Choose the variance estimator separately. vartype = "bootstrap" (the default for every method) resamples units, or clusters with cl. "jackknife" leaves out one unit at a time. "parametric" works only in the gsynth setting. vartype = "conformal" gives conformal intervals from leave-one-control-out fits instead of resampling (gsynth, ife and mc with an absorbing treatment), and full conformal sets with method = "fe"; add conformal.block = TRUE for averages, conformal.diag for pre-treatment diagnostics and conformal.relabel for a test of no effect (see Chapter 8 and ?fect). See Chapter 7.

13.2 Option combinations that fect changes or refuses

Some combinations of options are changed by fect() before it fits, and some stop with an error. The tables below list them. The last column says how fect() reports the change. “Nothing” means that the change happens without a message.

13.2.1 Method and model

Setting What fect does Notice
method = "fe" with r or CV = TRUE Ignores both and fits r = 0 without cross-validation. nothing
method = "ife" or "gsynth", r not given Cross-validates r from 0 to 5 (CV becomes TRUE). CV progress
the same, with CV = FALSE Fits r = 0, the FE model; the fit reports method = "fe". message
"ife" or "gsynth" with one value of r No cross-validation. With CV = TRUE, that value is the only candidate. nothing
method = "mc", lambda not given, CV = FALSE Fits the FE model (r = 0); the fit reports method = "fe". message
method = "cfe" with the default time.component.from = "notyettreated" Turns cross-validation off, even with CV = TRUE, and fits the smallest value of r, so r = c(0, 3) fits r = 0. The fit reports method = "fe" (r = 0) or "ife" (r > 0). nothing
method = "gsynth" Sets time.component.from = "nevertreated" and em = FALSE. nothing
method = "ife" or "fe" with time.component.from = "nevertreated" Fits the gsynth model; the fit reports method = "gsynth". nothing
group.fe with method = "fe" Fits method = "cfe" with r = 0 and no cross-validation. With one group.fe column and no cl, clusters the bootstrap by that column. nothing
group.fe with "ife", "mc", "both" or "gsynth"; two or more group.fe columns without cl Stops. error
Z, gamma, Q, kappa or Q.type with a method other than "cfe" Ignores them. nothing
more than two index columns with a method other than "cfe" Stops. error
"gsynth" on data where treatment switches off Stops. error
"mc" or "both" with time.component.from = "nevertreated"; em = FALSE with "notyettreated" Stops. error
loading.bound = "simplex" with a method other than "ife" or "gsynth", or with "notyettreated" Stops. When the chosen r is 0, the bound has no effect. error; message
cm = TRUE with a method other than "fe" or "ife", or with "nevertreated" Stops. error
method = "both" with criterion = "pc" Stops. error

13.2.2 Tests

Setting What fect does Notice
loo = TRUE Sets se = TRUE, and turns off placeboTest and carryoverTest. messages
dloo = TRUE Sets se = TRUE. Needs method = "fe", time.component.from = "notyettreated", no treatment reversal, a balanced panel before treatment, and vartype = "bootstrap" or "jackknife"; cannot be combined with loo, placeboTest, carryoverTest or permute. Otherwise stops. message; error
placeboTest = TRUE without placebo.period; carryoverTest = TRUE without carryover.period Stops. error
placeboTest = TRUE and carryoverTest = TRUE Stops. error
placeboTest or carryoverTest with cross-validation Stops. This includes "ife" or "gsynth" without r, and "mc" without lambda, since they cross-validate by default. Give a single r or lambda. error
carryoverTest = TRUE when treatment never switches off Stops. error
permute = TRUE with placeboTest, carryoverTest, loo or carryover.rm, or with method = "gsynth" Stops. The permutation test runs for "fe", "ife" and "mc". error
balance.period with group or with carryover.rm Stops. error
carryover.rm that is not a single non-negative whole number Stops. 0 means none. error
carryover.rm with time.component.from = "nevertreated" (and so method = "gsynth") Ignored: these fits use no cell of a treated unit, so there is nothing to remove. warning
carryover.rm when no treated unit leaves treatment within the panel Removes nothing. message
fill.missing without balance.period Ignored. nothing

13.2.3 Inference

Setting What fect does Notice
se = FALSE (the default) Ignores nboots, vartype, cl, ci.method and keep.sims. nothing
vartype = "parametric" Needs time.component.from = "nevertreated" (as with "gsynth"), no treatment reversal, a method other than "mc" or "both", and at least two never-treated units. Otherwise stops. Ignores cl. error; warning for cl
cv.method = "forward" GSC only ("gsynth", or "ife" with "nevertreated"), and needs CV = TRUE or a range in r. Chooses the rank with fect_rank()’s forward rule, then fits at it. Otherwise stops. error; message with the pick
vartype = "conformal" Needs method "fe" (full conformal sets; no covariates, force not "none", no conformal.block or conformal.relabel), "gsynth", "ife" or "mc", an absorbing treatment, at least two never-treated units, and 0 < alpha < 1. Stops with weights, group, balance.period, placebo, carryover, loo, permutation tests, cm, extra fixed effects, binary outcomes or loading.bound. Ignores cl. S.E. is NA. error; warning for cl
para.error with vartype other than "parametric" Ignored. nothing
vartype = "jackknife" with cl Ignores cl, since the jackknife leaves out one unit at a time. warning
vartype = "jackknife" with ci.method = "basic" Stops. error
cl equal to the unit index (index[1]) The same as no cl: the bootstrap resamples units. nothing
ci.method = "basic" with nboots below 1000 Fits as asked. warning
CV = TRUE The folds use max(tol, 1e-3); the chosen model is then refitted at tol. nothing

13.2.4 Data

Setting or data What fect does Notice
rows whose weight (W, W.est or W.agg) is 0 Drops these rows before fitting; a unit whose weights are all 0 leaves the fit. nothing
W.est and W.agg naming different columns Stops. error
infinite values in the outcome Sets them to NA. warning
units with fewer than min.T0 untreated observations Removes them before fitting (listed in fit$remove.id). message
units with more than max.missing missing periods Removes them before fitting (listed in fit$remove.id). a message only when 10 or fewer units remain
a period in which no unit is untreated Drops the period. message
na.rm = FALSE (the default) with missing Y or X Keeps the rows but leaves those cells out of the fit. Missing D or index values stop. error for D and index

13.3 Where the results are

?fect lists every slot of a fit under “Value”. The ones most often read:

Slot Contents
att.avg, est.avg The overall ATT; with se = TRUE, est.avg adds S.E., CI.lower, CI.upper and p.value.
att, time, count; est.att The ATT by period relative to treatment onset (1 is the first treated period, 0 the last one before it) and the number of treated cells in each; est.att has the columns ATT, S.E., CI.lower, CI.upper, p.value and count.
est.att90, att.bound The same with the (1 - 2alpha) interval, 90% by default, which the equivalence plot draws.
att.off, est.att.off The ATT by period relative to treatment exit, when treatment switches off.
eff, Y.ct Cell-level effects and predicted untreated outcomes, T by N matrices (rows are periods, columns are units).
test.out The F test and equivalence tests of the pre-treatment estimates (f.p, f.equiv.p, tost.equiv.p), or the placebo or carryover test (placebo.p, placebo.equiv.p; carryover.p, carryover.equiv.p).
est.placebo, est.carryover The placebo or carryover ATT with its S.E., interval, p-value and 90% interval.
r.cv, lambda.cv, CV.out The chosen number of factors or lambda, and the cross-validation scores of each candidate.
rank.forward (v2.5.0) With cv.method = "forward", the forward rule’s table.
beta, est.beta Covariate coefficients, and with se = TRUE their inference.
remove.id, obs.missing Units removed before fitting, and a T by N code of each cell (1 treated, 2 untreated, 3 missing, 4 removed unit, 5 held out for a test, 6 removed by carryover.rm).

13.4 Methods

Inputs for fect(method = "___")

Method Model for \(\hat{Y}(0)\) References
fe Standard two-way fixed effects model Liu, Wang & Xu (2022), Borusyak, Jaravel & Spiess (2024)
ife Interactive fixed effects model; by default the factors are estimated from all untreated observations (time.component.from = "notyettreated") Gobillon & Magnac (2016), Xu (2017)
mc Matrix completion method Athey et al. (2021)
cfe “Complex” or multi-level fixed effects –
gsynth Interactive fixed effects model with the factors estimated from the never-treated units only (time.component.from = "nevertreated") Xu (2017)

13.5 Plot Types

Inputs for plot(fect_object, type = "___"). The last column says what the fit needs; Chapter 12 has the full table, with what each plot draws without uncertainty estimates.

Type Description Needs from the fit
gap or es Event-study plot: ATT by pre- and post-treatment periods. Any fit; intervals need se = TRUE, and so does a fit with a placebo or carryover test.
equiv Pre-treatment ATTs with their 90% intervals and the equivalence range. se = TRUE
exit Period-wise ATT relative to treatment exit. Treatment that switches off; intervals need se = TRUE.
counterfactual or ct Observed vs. imputed outcome for treated units. Any fit.
status Treatment status by period for all units. Any fit.
box Box plot of the cell-level effects by period. Any fit.
calendar ATT by calendar time. Any fit; intervals need se = TRUE.
heterogeneous or hte ATT by a covariate. covariate: the name of a covariate of the fit, or a T x N matrix.
factors Estimated factors. method = "ife" or "gsynth" with at least one factor.
loadings Estimated factor loadings. The same as factors.
loading.overlap Treated units’ factor loadings against the convex hull of the control loadings. The same as factors.
sens Rambachan & Roth (2023) sensitivity analysis for the average effect over the post-treatment periods. The output of fect_sens().
sens_es Sensitivity analysis by event time. The output of fect_sens().
cumul Cumulative treatment effects over time. The output of effect(); for new code use estimand(fit, "att.cumu", "event.time") with esplot() (see Chapter 3).

13.6 Tests as Options

Inputs for fect(...)

Input Description Applicable Methods
loo Leave-one-period-out goodness-of-fit test (TRUE/FALSE). fe, ife, mc, gsynth
dloo Double (cohort-wise) leave-one-out pre-trend placebos, computed from the in-sample fit without re-fitting (TRUE/FALSE). Staggered adoption and a balanced pre-treatment panel only. fe
dloo.adjust With dloo = TRUE: use the pre-treatment-average baseline of Liu (2025) (TRUE/FALSE). fe
carryoverTest Tests for carryover effects in post-treatment periods (TRUE/FALSE). fe, ife, mc, cfe
carryover.period Range of post-treatment periods for the carryover test (vector). fe, ife, mc, cfe
permute Permutation test (TRUE/FALSE). fe, ife, mc
m Block length for permutation test (m=2 by default). fe, ife, mc
CV Cross-validation for factor-based methods. ife, mc, gsynth

13.7 Required and Optional Inputs

A check mark (✓) indicates that the method requires or accepts the input.

13.7.1 Required Inputs

Input fe ife mc gsynth cfe
Y (outcome) ✓ ✓ ✓ ✓ ✓
D (treatment) ✓ ✓ ✓ ✓ ✓
X (covariates) ✓ ✓ ✓ ✓ ✓
data ✓ ✓ ✓ ✓ ✓
index (unit & time IDs) ✓ ✓ ✓ ✓ ✓
group.fe (additional additive FEs; auto-routes fe → cfe) ✓ – – – ✓
Z (time-invariant covariates) – – – – ✓
Q (known time trends) – – – – ✓
Q.type (auto time trends) – – – – ✓

13.7.2 Optional Inputs

Input fe ife mc gsynth cfe
W (weight column; convenience default for both W.est and W.agg) ✓ ✓ ✓ ✓ ✓
W.est (weight column for outcome-model fit only) ✓ ✓ ✓ ✓ ✓
W.agg (weight column for ATT aggregation only) ✓ ✓ ✓ ✓ ✓
time.component.from (time component source) – ✓ – ✓ ✓
em (EM algorithm) – ✓ – – ✓
se (uncertainty) ✓ ✓ ✓ ✓ ✓
nboots (# bootstrap reps) ✓ ✓ ✓ ✓ ✓
force (FE structure) ✓ ✓ ✓ ✓ ✓
lambda (Hyper-parameter sequence) – – ✓ – –
nlambda (Length of hyper-parameter sequence) – – ✓ – –
r (# factor) – ✓ – ✓ ✓
k ( # cross-validation rounds) – ✓ ✓ ✓ –
gamma (time grouping for Z) – – – – ✓
kappa (unit grouping for Q) – – – – ✓
Z.param (Z block assignment) – – – – ✓
Q.param (Q block assignment) – – – – ✓
Q.bspline.degree (B-spline degree) – – – – ✓

13.7.3 Important Options

Input Options Applicable Methods
force Fixed effects structure: “none”, “unit”, “time”, “two-way” (default) fe, ife, mc, cfe, gsynth
time.component.from Time component source: “notyettreated” (default), “nevertreated”. Controls which units provide the time-varying model components (time fixed effects, latent factors, temporal dynamics). When “nevertreated”, only never-treated controls estimate these components. method = "gsynth" auto-sets to “nevertreated”. method = "mc" supports “notyettreated” only. ife, cfe, gsynth
em EM algorithm: TRUE (default), FALSE. Required TRUE for “notyettreated”; auto-set to FALSE by method = "gsynth". ife, cfe
vartype Uncertainty estimator: “bootstrap” (default for every method, including gsynth), “jackknife”, “parametric”, or “conformal”. “parametric” needs time.component.from = "nevertreated" and no treatment reversal, and is not available for mc; set it explicitly when there are few treated units. “conformal” gives conformal intervals for gsynth, ife and mc, and full conformal sets for fe (see ?fect; conformal_sc() for other target-date estimators such as synthetic control). fe, ife, mc, cfe, gsynth
criterion Model selection criterion: “mspe” (default), “gmspe”, “moment”, “pc”. ife, mc, cfe, gsynth

13.8 Cross-Validation

Cross-validation in fect() selects the number of factors r (or the regularization lambda for MC) by minimizing held-out prediction error. As of v2.3.0, three masking strategies are exposed via cv.method:

13.8.1 Choosing the masking strategy

cv.method Mask design When to use
"rolling" (default) Per-fold sample of cv.prop of eligible units; per sampled unit a random anchor + cv.nobs scored holdout + cv.buffer past-side buffer + drop-future from anchor through end-of-eligible. Eligible units = controls + treated pre-treatment cells. The recommended default. Closes the future-side leakage channel that block CV cannot, eliminating the over-selection pathology that pegs r.cv = r.max on serially correlated panels.
"block" Random scattered anchors; mask cv.nobs contiguous cells per anchor; cv.donut cells flanking each side excluded from training but not scored. Eligible units = controls. Use under approximately i.i.d. residuals when forecast-style scoring is not needed.
"loo" Leave-one-out, one treated pre-treatment period at a time. Legacy gsynth method; can be unstable with few pre-treatment periods. Available only with time.component.from = "nevertreated" (including method = "gsynth").
"forward" (v2.5.0) No mask: GSC is fitted at every rank, and each treated unit’s pretreatment outcomes are predicted from its earlier ones (fect_rank()). GSC with serially correlated errors and about 15 or more pretreatment periods; the rank rule of Section 6.2. GSC only; the k, cv.prop, cv.nobs and cv.rule options do not apply.
WarningDeprecation: "all_units" and "treated_units"

Pre-v2.3.0 callers used cv.method = "all_units" (= the new "block") or cv.method = "treated_units" (block masking with anchors restricted to treated pre-treatment cells). Both names still work and print a note. "all_units" behaves exactly like "block", so use "block" instead. "treated_units" has no replacement yet and can still be used.

13.8.2 Sub-options (apply across "all_units", "treated_units", and "rolling" unless noted)

Option Default Applies to Description
k 20 all Number of CV folds
cv.prop 0.1 all For block: proportion of observations masked per round. For rolling: fraction of eligible units sampled per fold. The (k = 20, cv.prop = 0.1) pair gives ~2x coverage of every eligible unit across folds while keeping per-fold mask size moderate.
cv.nobs 3 all Block size for the held-out (scored) cells per anchor
cv.donut 1 block only Cells excluded around the holdout on each side, masked but not scored (attenuates AR leakage on both train/test boundaries; matches cv.buffer for rolling CV)
cv.buffer 1 rolling only Past-side buffer cells before the holdout, masked but not scored (the future side is dropped from training by construction)
cv.rule "min" all Rule for picking r from the MSPE curve: "min" (default since v2.4.7; the r with the lowest error), "1se" (the smallest r within one fold standard error of the lowest; Hastie/Tibshirani/Friedman 2009 §7.10; the default from v2.3.0 to v2.4.6), or "1pct" (pre-v2.3.0 default)
min.T0 1 for fe, 5 otherwise all Minimum number of observations under control required per unit
seed NULL all Optional integer seed for reproducible per-fold mask sampling

13.8.3 Scoring criteria

The criterion parameter determines which metric is used to select the tuning parameter:

criterion Description When to use
"mspe" (default) Mean squared prediction error General-purpose; best for prediction accuracy
"gmspe" Geometric mean SPE Robust to outlier prediction errors
"pc" Information criterion (Bai & Ng) Penalized fit; does not require CV rounds
"moment" Weighted period-wise residual averages Selects for best pre-trend fit rather than prediction

13.8.4 Workflow

## Pick r via rolling CV (recommended)
fit_cv <- fect(Y ~ D, data = simdata, index = c("id", "time"),
               method = "ife", force = "two-way",
               CV = TRUE, r = c(0, 3),
               cv.method = "rolling",
               cv.buffer = 1, cv.nobs = 3, k = 20, cv.prop = 0.1,
               cv.rule = "min", se = TRUE)
fit_cv$r.cv  # selected r

Block-CV variants are drop-in replacements: change cv.method to "block" (or the legacy "treated_units") and replace cv.buffer with cv.donut (the buffer-parameter analog for block CV).

NoteWhy we prefer rolling CV: empirical evidence

When residuals are temporally correlated (post-fit residual AR(1) above ~0.4), block CV consistently over-selects r, often pegging at r.max. Rolling CV is the recommended choice in this regime; on approximately i.i.d. residuals the two designs agree closely.

Xu (2017) factor-model DGP, \(r_{\text{true}} = 2\), \(K = 200\) replications per cell, default settings:

Errors Rolling CV recovery Mean rolling r.cv Block CV recovery Mean block r.cv
iid (ρ = 0) 95.5% 1.96 88.0% 1.88
AR(1) ρ = 0.3 99.0% 1.99 88.5% 1.95
AR(1) ρ = 0.8 56.2% 1.58 15.0% 3.34

At ρ = 0.8, block CV picks r.cv ≥ 3 in 98.5% of IFE-EM reps and pegs at r.max = 5 in 17.5%; rolling CV picks r.cv ≥ 3 in only 4% and never pegs.

Rolling CV imposes essentially no penalty in the no-leakage regime and recovers the truth ~3.7× more often when leakage matters. Source script: code/sims/sim-cv-comparison-K200.R.

The standalone r.cv.rolling() helper exists for users who want the per-fold MSPE matrix and other diagnostics returned in addition to r.cv — but for normal use, the dispatcher path above is the recommended entry point.

Since v2.4.7, r.cv.rolling() and fect_mspe() score the model’s full prediction at each held-out cell: the intercept, the fixed effects, the covariates and the factors. Their scores, and the r that r.cv.rolling() selects, can differ from earlier versions. A held-out unit with few periods before the held-out block adds large errors, so a larger min.T0 (for example 10 instead of the default 5) gives a steadier choice.

13.9 Utility Functions

In addition to the main fect() function, the package provides several utility functions:

Function Description Key Arguments
esplot() Standalone event study plot from a data frame. Does not require a fect object. data, Period, Estimate, CI.lower, CI.upper, connected, highlight.periods
fect_mspe() Model comparison via cross-validated prediction error. Supports cv.method = "rolling" for AR-leakage-resistant scoring. out.fect, seed, cv.method, cv.buffer, criterion, k, cv.prop
r.cv.rolling() Standalone rolling-window CV for selecting r (number of factors). Recommended over block CV when residuals are serially correlated. Supports method ∈ {"ife", "gsynth", "cfe"}. formula, data, index, method, r.max, cv.nobs, cv.buffer, k, cv.prop, cv.rule, seed
get.cohort() Generate cohort indicators based on treatment timing. data, D, index, entry.time, start0
overlap_check() (v2.5.0) Overlap check without a rank: can each treated unit’s pretreatment path be rebuilt from the never-treated units as well as they rebuild one another? See Section 6.2. formula, data, index, level, max.heldout, groups, seed
fect_rank() (v2.5.0) GSC at every rank; the forward and leave-one-out rank rules, the window check, and the estimate at every rank. formula, data, index, r, se, ... (to fect())
loading_check() (v2.5.0) Loading check at the chosen rank for a GSC fit, the extrapolation share, and with trim = TRUE the estimate without the flagged units. fit, level, trim, data, r
estimand() Unified post-hoc estimand dispatcher: per-event-time and overall ATT, cumulative ATT, APTT, log-ATT, with bootstrap or jackknife CIs. See Chapter 3. fit, type, by, cells, weights, window, direction, vartype, conf.level, ci.method
imputed_outcomes() Long-form accessor: cell-level imputed potential-outcome surface for custom estimands. fit, cells, replicates, direction
att.cumu() (Soft-deprecated; use estimand(fit, "att.cumu", "overall", window = ...).) Cumulative treatment effects over a specified period range. x, period, weighted, type
effect() (Soft-deprecated; use estimand(fit, "att.cumu", "event.time") or estimand(fit, "att", "event.time").) Cumulative or subgroup-averaged treatment effects; requires keep.sims = TRUE. x, cumu, id, period, plot

13.10 Notes

  • Most methods share core inputs (Y, D, X, data, index). Give the variables either in a formula such as Y ~ D + X1 + X2, which takes bare column names only, or as column names in Y, D and X, not both. Covariates must be numeric (see Chapter 2).

  • Method cfe allows either “jackknife” or “bootstrap” for uncertainty estimates.

  • Factor-based methods (ife, gsynth) can use r and k for factor selection and cross-validation. mc uses lambda and nlambda instead of r.

  • carryoverTest is available in fe, ife, mc, and cfe but not in gsynth. loo is available in fe, ife, mc, and gsynth. dloo is available in fe only, and only for staggered adoption without reversal.

  • The cfe method supports additional parameters: Z/gamma for time-invariant covariates with time-varying coefficients, Q/kappa (or Q.type) for unit-specific time trends, extra additive fixed effects via index[3:], and interactive fixed effects via r. See Chapter 5 for details.

  • force allows various levels of fixed effects ("none", "unit", "time", "two-way").

  • fect includes several built-in values for optional arguments that often require an integer or boolean input. Most logical arguments, such as se, placeboTest and loo, default to FALSE. The exceptions are parallel = TRUE, em = TRUE, and CV = NULL, which turns cross-validation on for ife and gsynth when r is not a single number, and for mc when lambda is not a single number. Below is a complementary table listing parameters that require numeric inputs.

Inputs Description Default
nboots Number of bootstrap runs (int) 200
k Sets the number of cross-validation rounds(int) 20
r Sets the number of factors NULL: cross-validated over 0 to 5 for ife/gsynth, 0 for fe/cfe; a range such as c(0,3) sets the CV search
m Specifies the block length for the permutation test 2
nlambda Length of hyper-parameter sequence 10
alpha Significance level. Intervals in est.att, est.avg and the other est.* slots are (1 - alpha); att.bound, est.att90 and the equivalence tests use (1 - 2alpha) 0.05
min.T0 Minimum number of untreated observations a unit needs; units with fewer are removed NULL: 1 for fe, 5 otherwise
max.missing Maximum number of missing periods a unit may have; units with more are removed NULL: no limit
proportion Pre-treatment periods with fewer than proportion times the largest number of treated units are left out of the F and equivalence tests 0.3
f.threshold Equivalence bound of the F test (see ?fect) 0.5
tost.threshold Equivalence range of the TOST tests, [-tost.threshold, tost.threshold] NULL: 0.36 times the residual standard deviation of the FE model
cores Number of cores for parallel computing NULL: available cores minus two, at most 8
tol, max.iteration Convergence tolerance and iteration cap of the EM and other iterative fits 1e-5, 5000
  • With an integer input for nlambda, fect can randomly generate appropriate hyper-parameter sequence.

  • normalize = TRUE divides the outcome and the covariates by the standard deviation of the outcome during estimation; every slot of the fit is still reported on the outcome’s scale, so it changes only the speed.

  • fill.missing is read only with balance.period. With FALSE (the default), a treated unit enters the balanced sample only if its outcome is observed at every period of the window; with TRUE, missing outcomes inside the window do not exclude it, and the balanced estimates average its observed cells.

Enjoy using fect!